Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ SEOAnalyzer - Native PHP 8+ SEO Audit & Technical Engine

Author PHP Version License Zero Dependencies Architecture

A high-performance, zero-dependency, object-oriented Native PHP 8+ SEO Audit & Technical Analysis engine. Designed for developers, digital marketers, and agencies who need fast, comprehensive, and modular web page diagnostics via Web UI, CLI tool, or REST API.


🌟 Key Highlights & Features

  • 🚀 Zero External Dependencies: Runs out-of-the-box using native PHP extensions (curl, dom, libxml, mbstring, json).
  • 📐 Clean Modern Architecture: Built with modern PHP 8+ features (declare(strict_types=1);, Typed Properties, Constructor Promotion, Match Expressions, Enums, PSR-4 Autoloading).
  • 📊 9 Comprehensive Diagnostic Modules:
    1. Meta Tags & HTML Head: Title/Description length, Canonical URLs, Robots meta, Charset, Favicon.
    2. Headings Structure: H1 count & presence, H2–H6 hierarchy completeness, empty heading detection.
    3. Content & Keywords: Word count, Text-to-HTML ratio, reading time estimation, top keyword density calculations & keyword stuffing prevention.
    4. Images Optimization: Missing & empty alt attributes count, native loading="lazy" usage.
    5. Links & Anchor Text: Internal vs external ratio, nofollow counts, non-descriptive generic anchor text detector ("click here", "read more").
    6. Social & OpenGraph: og:title, og:image, og:description, Twitter Card validation.
    7. Security & HTTPS: SSL/HTTPS check, Security Headers (HSTS, X-Frame-Options, X-Content-Type-Options, Content-Security-Policy, Referrer-Policy).
    8. Performance & Speed: Time To First Byte (TTFB), total load time, HTTP response status codes, GZIP/Brotli compression check.
    9. Technical SEO: robots.txt availability, sitemap.xml location, mobile viewport tag, Schema.org JSON-LD microdata parsing.
  • 🖥️ Multiple Interfaces:
    • Web Dashboard: Interactive glassmorphism UI with animated SVG radial gauge score, category progress bars, and issue filter tabs.
    • CLI Command Tool: Colorized terminal output for CLI environments (php cli.php --url=...).
    • RESTful API: Programmatic JSON endpoint (api/analyze.php).
    • HTML & JSON Exporters: Export printable standalone HTML reports or JSON audits.

🏗️ Project Architecture

seoanalyzer/
├── api/
│   └── analyze.php           # REST API Endpoint
├── assets/
│   ├── css/style.css         # Modern Glassmorphism Web UI Styles
│   └── js/app.js             # Interactive Dashboard Logic & AJAX
├── src/
│   ├── Analyzers/            # Specialized Audit Modules
│   │   ├── AnalyzerInterface.php
│   │   ├── ContentAnalyzer.php
│   │   ├── HeadingsAnalyzer.php
│   │   ├── ImagesAnalyzer.php
│   │   ├── LinksAnalyzer.php
│   │   ├── MetaAnalyzer.php
│   │   ├── PerformanceAnalyzer.php
│   │   ├── SecurityAnalyzer.php
│   │   ├── SocialAnalyzer.php
│   │   └── TechnicalAnalyzer.php
│   ├── Core/                 # Core Fetching & Parsing Infrastructure
│   │   ├── DomParser.php
│   │   ├── HttpFetcher.php
│   │   └── ScoreCalculator.php
│   ├── Enums/                # PHP 8 Enums
│   │   ├── Category.php
│   │   └── Severity.php
│   ├── Exporters/            # HTML & JSON Report Exporters
│   │   ├── HtmlReportExporter.php
│   │   └── JsonExporter.php
│   ├── Models/               # Domain Models
│   │   ├── AnalysisResult.php
│   │   └── Issue.php
│   ├── Autoloader.php        # Native PSR-4 Autoloader
│   └── SEOAnalyzer.php       # Main Facade Class
├── cli.php                   # CLI Audit Runner
├── index.php                 # Web Dashboard
├── composer.json             # Composer Package Config
└── README.md

⚡ Quick Start & Installation

Requirements

  • PHP: >= 8.1
  • Extensions: curl, dom, libxml, mbstring, json

Direct Setup (WAMP / XAMPP / Native Web Server)

  1. Clone or download the repository into your web root (e.g. d:/WampServer/www/seoanalyzer).
  2. Open your browser and navigate to http://localhost/seoanalyzer/index.php.

💻 Programmatic Usage (PHP Library)

<?php

require_once __DIR__ . '/src/Autoloader.php';
\SEOAnalyzer\Autoloader::register();

use SEOAnalyzer\SEOAnalyzer;

$analyzer = new SEOAnalyzer();

// Audit URL and retrieve raw AnalysisResult model
$result = $analyzer->analyze('https://example.com');

echo "Overall SEO Score: " . $result->getScore() . " / 100\n";
echo "Execution Time: " . $result->getExecutionTime() . " seconds\n";

// Access individual issues
foreach ($result->getIssues() as $issue) {
    echo "[{$issue->severity->getLabel()}] {$issue->title}\n";
    echo "  Recommendation: {$issue->recommendation}\n";
}

// Export raw JSON
$json = $analyzer->analyzeAsJson('https://example.com');

// Export HTML report string
$htmlReport = $analyzer->analyzeAsHtml('https://example.com');

🖥️ CLI Usage

Audit any website directly from your terminal:

# Display colorized audit in terminal
php cli.php --url=https://example.com

# Output JSON
php cli.php --url=https://example.com --format=json

# Generate & Save HTML Report file
php cli.php --url=https://example.com --format=html --export=report.html

🌐 REST API Usage

POST or GET requests to api/analyze.php:

curl -X POST "http://localhost/seoanalyzer/api/analyze.php" \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com"}'

Sample JSON Response:

{
  "url": "https://example.com",
  "score": 92,
  "analyzed_at": "2026-07-30T15:20:00+03:00",
  "execution_time": 0.412,
  "counts": {
    "critical": 0,
    "warning": 2,
    "good": 15
  },
  "category_scores": {
    "meta": 100,
    "headings": 100,
    "content": 90,
    "images": 100,
    "links": 85,
    "social": 90,
    "security": 100,
    "performance": 100,
    "technical": 100
  }
}

📜 License

Distributed under the MIT License. See LICENSE for more information.

About

High-performance, zero-dependency Native PHP 8+ SEO Audit & Technical Analysis engine with Web Dashboard, CLI, and REST API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages