yohns / meta-generator
AI-powered meta description and keyword generator supporting Gemini and Claude.
v1.0.1
2026-03-16 00:19 UTC
Requires
- php: ^8.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^12.5
README
AI-powered meta description and keyword generator. Paste a content blurb and get an SEO-ready meta description (120-160 characters) and a set of 5-8 keywords — powered by Google Gemini or Anthropic Claude.
Requirements
- PHP 8.2+
- Extensions:
curl,json,mbstring - Composer
- A Gemini or Claude API key
Installation
composer install cp config/ai.example.php config/ai.php
Edit config/ai.php and add your API key:
'provider' => 'gemini', // or 'claude' 'gemini' => [ 'api_key' => 'YOUR_KEY_HERE', 'model' => 'gemini-2.0-flash', ], 'claude' => [ 'api_key' => 'YOUR_KEY_HERE', 'model' => 'claude-haiku-4-5-20251001', ],
Then serve the project from any PHP-capable web server (Apache, Nginx, Laragon, etc.) and open index.html.
Usage
- Open the app in your browser
- Paste or type a content blurb (up to 2000 characters)
- Click Generate
- Copy the resulting meta description or keywords
API Endpoint
POST /api/generate-meta.php
Content-Type: application/json
{"blurb": "Your content blurb here..."}
Response:
{
"success": true,
"provider": "gemini",
"data": {
"meta_description": "...",
"keywords": ["keyword1", "keyword2", "..."]
}
}
Rate Limiting
Rate limiting is enabled by default in the config (per IP):
'rate_limit' => [ 'enabled' => true, 'rpm' => 5, // Requests Per Minute 'rpd' => 20, // Requests Per Day 'storage_path' => __DIR__ . '/../storage/rate_limit.json', ],
The storage_path is configurable — point it to any writable location. The directory is created automatically on first request.
Adding a Provider
- Create a class in
src/MetaGenerator/extendingAbstractMetaGenerator - Implement the
generate(string $blurb): arraymethod - Add a case to
MetaGeneratorFactory::make() - Add the provider's config block to
config/ai.example.php
License
MIT