sharpapi / laravel-seo-generate-tags
AI SEO Meta Tag Generator for Laravel powered by SharpAPI.com
Package info
github.com/sharpapi/laravel-seo-generate-tags
pkg:composer/sharpapi/laravel-seo-generate-tags
Requires
- php: ^8.1
- ext-json: *
- laravel/framework: ^10.48.29|^11.0|^12.0|^13.0
- sharpapi/php-core: ^1.4.1
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^8.22|^9.0|^10.0|^11.0
- pestphp/pest: ^2.34|^3.0|^4.0
- symfony/yaml: ^6.0|^7.0|^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package provides a Laravel integration for the SharpAPI SEO Meta Tag Generator. It allows you to automatically generate all important META tags for your web content, which is perfect for improving your website's SEO and social media sharing appearance.
Installation
You can install the package via composer:
composer require sharpapi/laravel-seo-generate-tags
Configuration
Publish the config file with:
php artisan vendor:publish --tag="sharpapi-seo-generate-tags"
This is the contents of the published config file:
return [ 'api_key' => env('SHARP_API_KEY'), 'base_url' => env('SHARP_API_BASE_URL', 'https://sharpapi.com/api/v1'), 'api_job_status_polling_wait' => env('SHARP_API_JOB_STATUS_POLLING_WAIT', 180), 'api_job_status_polling_interval' => env('SHARP_API_JOB_STATUS_POLLING_INTERVAL', 10), 'api_job_status_use_polling_interval' => env('SHARP_API_JOB_STATUS_USE_POLLING_INTERVAL', false), ];
Make sure to set your SharpAPI key in your .env file:
SHARP_API_KEY=your-api-key
Usage
use SharpAPI\SeoGenerateTags\SeoGenerateTagsService; $service = new SeoGenerateTagsService(); // Generate SEO meta tags $seoTags = $service->generateSeoTags( 'Your page content or URL here. Make sure to include links and image URLs for better results.', 'English', // optional language 'professional' // optional voice tone ); // $seoTags is a status URL, not the result. fetchResults() polls until the job finishes // (run it in a queued job, not in a web request). $job = $service->fetchResults($seoTags); if ($job->status === \SharpAPI\Core\Enums\SharpApiJobStatusEnum::SUCCESS->value) { $result = json_decode($job->getResultJson(), true); }
Parameters
text(string): The text content or URL to generate meta tags fromlanguage(string|null): The language for the meta tags as a full name, e.g. "English" (optional)voiceTone(string|null): The tone of voice for the meta tag content (e.g., professional, casual)
Response Format
fetchResults() returns a SharpApiJob; its result is the attributes.result part of the API response below:
{
"data": {
"type": "api_job_result",
"id": "397676a9-599b-4f6d-822a-d9d9f32b3890",
"attributes": {
"status": "success",
"type": "seo_generate_tags",
"result": {
"meta_tags": {
"title": "Las Vegas Grand Prix: A Showstopper Event",
"author": "",
"og:url": "",
"og:type": "article",
"keywords": "Las Vegas Grand Prix, Max Verstappen, Formula 1, F1, Lewis Hamilton, Fernando Alonso",
"og:image": "",
"og:title": "Las Vegas Grand Prix: A Showstopper Event",
"description": "Max Verstappen and other F1 stars share their thoughts on the Las Vegas Grand Prix.",
"og:site_name": "",
"twitter:card": "summary",
"twitter:image": "",
"twitter:title": "Las Vegas Grand Prix: A Showstopper Event",
"og:description": "Max Verstappen and other F1 stars share their thoughts on the Las Vegas Grand Prix.",
"twitter:creator": "",
"twitter:description": "Max Verstappen and other F1 stars share their thoughts on the Las Vegas Grand Prix."
}
}
}
}
}
Features
- Generates SEO-optimized page titles
- Creates compelling meta descriptions
- Provides relevant keywords
- Includes Open Graph tags for social media sharing
- Adds Twitter Card meta tags
- Optimizes content for search engines
AI agents (Laravel Boost)
This package ships a Laravel Boost skill, sharpapi-seo-generate-tags, that teaches AI coding agents how to call SeoGenerateTagsService correctly: submit, then fetchResults() in a queued job, check the job status, and read the result. It loads on demand and adds no always-on guideline. Boost 2 or newer is required.
In the host app:
composer require laravel/boost --dev php artisan boost:install # first time php artisan boost:update --discover # already using Boost
Select sharpapi/laravel-seo-generate-tags when Boost lists the packages it found.
Credits
License
The MIT License (MIT). Please see License File for more information.