- How do I install eusonlito/laravel-meta in a Laravel application?
- Install it with Composer using eusonlito/laravel-meta. Laravel package auto-discovery registers the service provider, so you typically only need to publish the config file with vendor:publish. Then set meta values from a controller or Blade layout and render the tags inside your head partial.
- Which Laravel versions does eusonlito/laravel-meta support?
- The package describes support for Laravel 5 and newer, including Laravel 10. Always check its composer.json for the exact PHP and illuminate/* version constraints before installing. Laravel 11 and 12 compatibility should be verified against the package constraints rather than assumed from the broad description.
- How do I publish and configure the laravel-meta config file?
- Publish the package config with vendor:publish after installing the package. Put site-wide defaults such as site name, default Open Graph image, and Twitter handle in the config file so controllers only override page-specific values. In deployments, clear cached Blade views when changing config so the rendered head reflects the new defaults.
- Can I set meta tags from a controller as well as from Blade views?
- Yes. The package exposes a Meta facade or singleton that can be called from controllers or middleware to set titles, descriptions, canonical URLs, robots, Open Graph, and Twitter Card values. Blade helpers or directives then emit those values inside the layout head. Config defaults fill in values that a given page does not explicitly set.
- Does laravel-meta support Open Graph and Twitter Card tags?
- Yes. Laravel Meta is designed for SEO and social metadata, including Open Graph and Twitter Card tags alongside title, description, keywords, canonical URL, and robots directives. You can set page-specific social values per route while keeping site-wide defaults in config.
- Is laravel-meta output escaped by default, and how should I handle user-generated meta content?
- Because meta values often come from user-generated content, escaping behavior is a key security check before production use. Treat titles and descriptions sourced from users as untrusted and sanitize them rather than passing raw HTML. Confirm the package's documented path for trusted raw HTML and avoid using it with user input, since incorrect escaping can enable XSS in the head.
- Will laravel-meta work correctly with Laravel Octane or long-lived workers?
- The package uses a singleton or facade-style state holder, so long-lived workers such as Laravel Octane deserve explicit testing. Verify that meta values do not leak from one request to the next when a worker is reused. Reset or reinitialize meta state per request if needed, and include this in your production readiness checks.
- How should I test laravel-meta output in Laravel feature tests?
- Render the routes or templates that own the head and assert on the resulting title, description, canonical, Open Graph, and Twitter tags in the HTTP response. Capture rendered head snapshots for your top templates before and after upgrading the package. Update any existing tests that assert hardcoded head content so they validate the new dynamic output.
- How do I avoid duplicate title and Open Graph tags when migrating to laravel-meta?
- Check whether your layout already emits hardcoded title or og:* tags, or whether another SEO package such as ralphjsmit/laravel-seo is already active. Migrate incrementally: install and configure defaults first, convert one page type at a time, and keep the old hardcoded block until parity is confirmed. Capturing before-and-after head snapshots makes duplicate or missing tags easy to spot.
- What changed in laravel-meta v3.3.0 and is it safe to upgrade?
- The v3.3.0 release notes are opaque, referencing an issue and PR without describing behavior changes or rendered output differences. Read the actual diff and test coverage for the changed path before upgrading, and check whether new or changed config keys require republishing. Because tag ordering, escaping, or default injection can affect SEO and analytics, capture head snapshots and roll out behind a canary or feature flag.