wearejust / metadata
This package is abandoned and no longer maintained.
No replacement package was suggested.
A package that simplifies the implementation of common metadata
2.0.0
2016-07-07 12:38 UTC
Requires
- illuminate/contracts: 5.1.*|5.2.*
- illuminate/support: 5.1.*|5.2.*
Requires (Dev)
- phpspec/phpspec: ^2.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
MetaData
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.
Installlation
Laravel 5 integration
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"
Example
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'); });
API of the $metaData object in view
/** * @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();