Download the PHP package mxschll/laravel-meta-tags without Composer
On this page you can find all versions of the php package mxschll/laravel-meta-tags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-meta-tags
Laravel Meta Tags
This package allows you easily to manage HTML meta tags from your controllers, blade views or really everywhere else. It is super customizable and easy to configure.
Installation
Navigate to the root directory of your Laravel project and run the following command from your console:
The package will automatically register a service provider.
In order to configure your installation you need to publish the configuration file:
You will find the configuration file at src/config/meta-tags.php
.
First Step
To get started, add the @meta
Blade directive inside the <head>
tag of your page:
Now all the standard tags are inserted into the page as set in the configuration file.
Usage in Blade Templates
Add specific meta tags
If you only want to add specific tags, you can do so by using the Blade directive @meta_get()
:
Set meta tag values
To set meta tags dynamically inside a Blade template, use @meta_set()
:
This generates the following meta tags:
As you can see, the values of all description tags have changed. Of course, you can also set individual values for each tag by giving the exact tag names:
This generates the following meta tags:
Usage in Controllers
You can set meta tags anywhere in your Laravel application by using \Meta::set($tag, $value)
:
Usage in Routes
Configuration
There are some special values you can use when setting meta tag values. These can not only be used in the configuration file, but everywhere where meta tags can be set.
Value | Description | Example |
---|---|---|
[url] |
Gets replaced with the current request url. | [url] |
[asset:ressource] |
Passes ressource to the asset() helper function. |
[asset:img/social.png] |