- How do I install artesaos/seotools in Laravel 5.8+?
- Run `composer require artesaos/seotools`—Laravel 5.5+ supports package discovery automatically, so no manual provider registration is needed unless you're on Laravel 5.5 or earlier. For Laravel 11+, update `bootstrap/providers.php` instead of `config/app.php`.
- Can I use SEOTools in Lumen?
- Yes, but facades won’t work. Use the service container directly via `app('seotools')` to access the same functionality. The package is fully compatible with Lumen’s lightweight architecture.
- How do I set dynamic page titles and meta tags?
- Use the `SEOMeta` facade in controllers or Blade templates. For example, `SEOMeta::setTitle('My Page')` or `@seoMeta(['name' => 'description', 'content' => $post->excerpt])` in Blade. Supports dynamic values like route parameters.
- Does SEOTools support OpenGraph and Twitter Cards?
- Absolutely. Use `OpenGraph::addProperty('title', $post->title)` and `TwitterCard::setCard('summary_large_image')`. Both support dynamic properties and are optimized for rich link previews.
- How do I generate JSON-LD structured data for Schema.org?
- Use the `JsonLd` facade to define structured data like `JsonLd::setTitle('Product')` and `JsonLd::addProperty('price', $product->price)`. For complex pages, `JsonLdMulti` lets you define multiple entities (e.g., products + reviews).
- Will SEOTools slow down my Laravel app?
- Minimal impact if used efficiently. Cache SEO metadata in view composers or route model binding. For APIs, generate metadata dynamically in controllers and inject it into responses using Laravel’s response macros.
- Can I customize SEO defaults for all pages?
- Yes, use middleware like `SEOMetaMiddleware` to set global defaults (e.g., site-wide title prefixes). Override them per route or controller as needed. Works seamlessly with Laravel’s middleware pipeline.
- How do I test SEO metadata in my Laravel app?
- Test facades in unit tests (e.g., `SEOMeta::getTitle()`) and Blade directives in integration tests. Use tools like Google’s Rich Results Test to validate JSON-LD output. Mock facades for isolated testing.
- Does SEOTools work with multi-language or multi-region apps?
- Yes, it supports locale-specific OpenGraph tags. Use `OpenGraph::setLocale('es_ES')` and dynamically set properties based on the current locale or region.
- Are there alternatives to SEOTools for Laravel?
- Other options include `spatie/laravel-seo` (simpler, less feature-rich) or manual meta tag generation. SEOTools stands out for its fluent API, JSON-LD support, and seamless integration with Laravel’s ecosystem, including Blade directives and middleware.