yohns / seo-manager
Building the SEO meta, twitter, opengraph, and schema for your webpage
dev-main
2025-07-01 23:10 UTC
Requires
- yohns/config: ^1.2
Requires (Dev)
- clean/phpdoc-md: ^0.19.3
This package is auto-updated.
Last update: 2025-07-01 23:10:34 UTC
README
composer require yohns/seo-manager
Generate favicons:
Usage:
php ex-favicon-generator.php <path-to-512x512-image>
Example:
php ex-favicon-generator.php logo.png
This will create so many favicons and the manifest file for your website.
Further testing would be nice, but this is within working order to get you started.
Documentation
- SEOManager Class - Main orchestrator class
- Favicons Class - Favicon tags management
- MetaTags Class - HTML meta tags management
- OpenGraph Class - Open Graph protocol
- TwitterCards Class - Twitter Card tags
- SchemaMarkup Class - Schema.org structured data
- Configuration - Setting up defaults
- Examples - Common usage patterns
Main Components:
1. SEOManager (Main Class)
- Central orchestrator for all SEO components
- Supports configuration via your Config class
- Provides unified access to all SEO features
- Can render all tags at once or individually
2. MetaTags Class
- Handles standard HTML meta tags
- Built-in validation for title length (60 chars) and description (155-160 chars)
- Supports keywords with normalization (lowercase, deduplication)
- Manages canonical URLs, robots, viewport, favicon
3. OpenGraph Class
- Full Open Graph protocol support
- Validates required tags (title, type, url, image)
- Supports all standard OG types
- Special handlers for articles, videos, audio
4. TwitterCards Class
- Supports all Twitter Card types (summary, summary_large_image, app, player)
- Automatic username normalization (adds @ if missing)
- Character limit enforcement (70 for title, 200 for description)
- Type-specific validation
5. SchemaMarkup Class
- Comprehensive Schema.org support
- Helper methods for all common types:
- Organization, Person, Product, Article
- Event, Recipe, Review, Video
- Book, Course, LocalBusiness, FAQPage
- SoftwareApplication, and more
- Generic schema builder for custom types
- JSON-LD output format
Key Features:
- Validation - Each component validates its tags according to best practices
- Configuration Support - Works with your Config class for defaults
- Fluent Interface - Chainable methods for easy use
- Flexible Output - Can render as HTML strings or return as arrays
- Character Limits - Automatic truncation with ellipsis for length-limited fields
- Best Practices - Follows all SEO guidelines from your documentation
Usage Pattern:
$seo = new SEOManager($config); $seo->setCommon([...]) // Set common properties across all components ->meta()->setTitle('...') ->openGraph()->setType('article') ->twitter()->setCard('summary_large_image'); echo $seo->render(); // Output all tags
The system is fully OOP, uses PHP 8.2+ features, and follows all the SEO best practices outlined in your documentation files.
TO-DO
Yohns\CoreConfig
to be used staticallyConfig::*()
- Test everything