foxted/meta

This package is abandoned and no longer maintained. No replacement package was suggested.

Small package to generate meta tags easily in your Laravel app

1.1.1 2014-10-27 21:49 UTC

This package is not auto-updated.

Last update: 2015-10-16 10:28:32 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Small package to generate meta tags easily in your Laravel app

Installation

First, pull in the package through Composer.

Laravel 4.2

"require": {
    "foxted/meta": "~1.0"
}

Laravel 5.0

"require": {
    "foxted/meta":"1.1.*"
}

Then include the service provider within app/config/app.php.

'providers' => [
    'Foxted\Meta\MetaServiceProvider'
];

Add a facade alias to this same file at the bottom:

'aliases' => [
    'Meta' => 'Foxted\Meta\Facades\MetaFacade'
];

And finally publish the view & config files:

php artisan view:publish foxted/meta
php artisan config:publish foxted/meta

Defaults

Defaults values are set in the config file, to override them, after you ran the php artisan config:publish foxted/meta command, navigate to app/config/packages/foxted/config.php and change the values as you want.

You can also delete them entirely if you do not want any defaults values, just be sure to keep the app/config/packages/foxted/config.php file and return an empty array, like so:

<?php

return [];

Usage

Within your controllers, before rendering your view, generate your tags:

public function index()
{
    Meta::title("My amazing website"); // <title>My amazing website</title>
    Meta::name("keywords", "awesome, keywords"); // <meta name="keywords" content="awesome, keywords">
    Meta::name("description", "The best website you've ever seen"); // <meta name="description" content="The best website you've ever seen">
    Meta::equiv("content-type", "text/html; charset=UTF-8"); // <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    return View::make("index");
}

To show your meta block in your view, just use the following Blade directive:

@meta

Contribution

Any ideas are welcome. Feel free the submit any issues or pull requests.

Enjoy ;)