This package allow you to simplify the process of adding meta tags to your HTML. It basically allows you to use a simple to use API.
This package ships with a Laravel 5 Service Provider to simplify the process. Also a ViewComposer is registered automatically so that there always is a variable $metaData
in the in the config specified views
app.php
'providers' => [
...
...
Just\MetaData\Laravel\MetaDataServiceProvider::class,
]
'aliases' => [
...
...
'MetaData' => Just\MetaData\Laravel\Facades\MetaData::class,
]
You can publish the (default) config by fire the following command
php artisan vendor:publish --provider="Just\MetaData\Laravel\MetaDataServiceProvider"
Route::get('/', function (Just\MetaData\MetaDataWrapper $manager) {
...
$images = [];
$manager->fromData('Title', 'Desription', $images);
//OR
$object = new SometingWithFollowingInterface(MetaDataInterface);
$manager->fromInterface($object);
// You may also use the Facade
$object = MetaData::fromInterface($object);
return view('welcome');
});
/**
* @return string
*/
public function getTitle();
/**
* @return string
*/
public function getDescription();
/**
* @return array
*/
public function getImages();
/**
* @return string
*/
public function getBaseUrl();
/**
* @return string
*/
public function getCurrentUrl();