Download the PHP package honeystone/laravel-seo without Composer
On this page you can find all versions of the php package honeystone/laravel-seo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download honeystone/laravel-seo
More information about honeystone/laravel-seo
Files in honeystone/laravel-seo
Package laravel-seo
Short Description SEO metadata and JSON-LD package for Laravel.
License MIT
Homepage https://honeystone.com
Informations about the package laravel-seo
Honeystone SEO Configurator for Laravel
The Honeystone SEO package makes configuring SEO metadata from anywhere within your Laravel application a breeze.
Included are metadata generators for general metadata, X (Formally Twitter) Cards, Open Graph and JSON-LD Schema.
This package was designed with extensibility in mind, so your own custom metadata generators can also be added with ease.
Support us
We are committed to delivering high-quality open source packages maintained by the team at Honeystone. If you would like to support our efforts, simply use our packages, recommend them and contribute.
If you need any help with your project, or require any custom development, please get in touch.
Installation
Publish the configuration file with:
Usage
The package provides a helper function, seo()
, and some Blade directives, @metadata
and @openGraphPrefix
. You
can also typehint the Honeystone\Seo\MetadataDirector
if you prefer to use dependency injection.
Setting metadata is a simple as chaining methods:
Once you've set your metadata, you can render it using:
Alternatively, you can also use the @metadata
Blade directive.
The rendered result will look something like this:
Default methods
Values provided to default methods will automatically propagate to all configured metadata generators.
The following default methods are available:
The full baseline looks like this:
For your homepage you'll probably want to disable the title template:
Meta methods
The meta methods are provided by the Honeystone\Seo\Generators\MetaGenerator
class.
Here's the full list:
All of these are provided by the default methods and propagate through to the meta generator.
If you only want to render the meta generator, use seo()->generate('meta')
or @metadata('meta')
Twitter methods
The meta methods are provided by the Honeystone\Seo\Generators\TwitterGenerator
class.
Here's the full list:
Open Graph methods
The meta methods are provided by the Honeystone\Seo\Generators\TwitterGenerator
class.
Here's the full list:
You can also use the following non-vertical supported types:
You can provide more data for images, audio and videos using their respective properties classes:
Here's an example using ArticleProperties
and ImageProperties
:
To set the prefix, you can use the @openGraphPrefix
Blade directive or seo()->openGraphPrefix()
like so:
JSON-LD methods
The meta methods are provided by the Honeystone\Seo\Generators\JsonLdGenerator
class.
Here's the full list:
And the output:
But Wait, There's More!
Rather than reinventing the wheel, this package has support for the incredible
spatie/schema-org package. You can use the jsonLdImport()
method to import an
exising schema, or build your schema using the fluent interface.
Just don't forget to install the spatie/schema-org
package to use this functionality.
Expectations / Check Ins
It's highly likely you'll be building your graph from many locations around your application, e.g. middleware, controllers, view composers, view components, etc.
This is where expectations come in. Simply specify your expectations, and then ensure the other parts of your application check in. If something failed to check in, an exception will be thrown. Conversely, if something unexpected checked in, an exception will also be thrown.
You'll be warned immediately if 'featured-tags'
or 'contact'
fail to check in.
This feature is entirely optional. Just don't set any expectations, or check in, and no exceptions will be thrown.
Model integration
This package doesn't include any specific functionality for integrating models. Ultimately, you'll always need to map
your model attributes to this package. For example, if your model has a meta_description
attribute, you will need to
map it to description
, otherwise this package would not know to consume it.
With this in mind, we have a simple pattern that should get you what you need.
Start by adding a new method to your model, and set your metadata using the model's attributes within:
Then in your controller, just call the method and chain any additional metadata:
Custom generators
To create a custom generator, simply implement the Honeystone\Seo\Contracts\MetadataGenerator
contract and add it to
your config file in the generators section. You can specify any configuration for your generator here too.
Removing the source comments
The package includes comments in the generated HTML. If you would like to remove them, you can publish the views and remove the comments from the Blade files:
Publishing the package views is generally not recommended as these files will not be updated when the package is updated. If it is absolutely necessary to publish the views, we recommend only publishing the files you need to modify.
Configuration
Here's the full config file:
Changelog
A list of changes can be found in the CHANGELOG.md file.
License
Honeystone Consulting Ltd
All versions of laravel-seo with dependencies
ext-zip Version *
illuminate/contracts Version ^10.0|^11.0|^12.0
spatie/laravel-package-tools Version ^1.16.4