PHP code example of mxschll / laravel-meta-tags

1. Go to this page and download the library: Download mxschll/laravel-meta-tags library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mxschll / laravel-meta-tags example snippets

+HTML
<head>
    <title>Laravel</title>
    @meta
    ....
</head>



namespace App\Http\Controllers;

use Illuminate\Http\Request;

class PageController extends Controller
{
    public function __construct()
    {
        \Meta::set('og:site_name:', 'Laravel');
    }
    
    public function showHomePage(Request $request)
    {
        \Meta::set('description', 'This is the home page description.');
        return view('home');
    }

    public function showArticlePage(Request $request)
    {
        \Meta::set('description', 'This is the article page description.');
        \Meta::set('og:type', 'article');
        return view('article');
    }
}


Route::get('/', function () {
    Meta::set('description', 'Hello World!');
    return view('welcome');
});

php artisan vendor:publish --provider="mxschll\MetaTags\MetaTagsServiceProvider"