PHP code example of archtechx / laravel-seo

1. Go to this page and download the library: Download archtechx/laravel-seo 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/ */

    

archtechx / laravel-seo example snippets


seo()
    ->title($post->title)
    ->description($post->excerpt)
    ->twitter()
    ->flipp('blog')

// Adds OpenGraph tags
// Adds Twitter card tags
// Generates social image using Flipp and sets it as the cover photo

seo()->title('foo')->description('bar')

seo()->twitter();

seo()->twitterTitle('About us')

seo()->favicon();

seo()
    ->title(default: 'ArchTech — Meticulously architected web applications')
    ->description(default: 'We are a web development agency that ...');

seo()->tag('fb:image', asset('foo'));
seo()->rawTag('<meta property="fb:url" content="bar" />');
seo()->rawTag('fb_url', '<meta property="fb:url" content="bar" />'); // Keyed, allows overrides later on

seo()->withUrl();

seo()->url(route('products.show', $this->product));

seo()->locale('de_DE');

seo()->title(modify: fn (string $title) => $title . ' | ArchTech');

seo()->title(
    default: 'ArchTech — Meticulously architected web applications',
    modify: fn (string $title) => $title . ' | ArchTech'
);

    'flipp' => [
        'key' => env('FLIPP_KEY'),
    ],
    

seo()->flipp('blog', 'v8ywdwho3bso');
seo()->flipp('page', 'egssigeabtm7');

seo()->flipp('blog', ['title' => 'Foo', 'content' => 'bar'])`

seo()->title($post->title);
seo()->description($post->excerpt);
seo()->flipp('blog');

<img alt="@seo('title')" src="@seo('flipp', 'blog')">

    'previewify' => [
        'key' => env('PREVIEWIFY_KEY'),
    ],
    

seo()->previewify('blog', 24);
seo()->previewify('page', 83);

seo()->previewify('blog', ['title' => 'Foo', 'content' => 'bar'])`

seo()->title($post->title);
seo()->description($post->excerpt);
seo()->previewify('blog');

<img alt="@seo('title')" src="@seo('previewify', 'blog')">

seo()
    ->site('ArchTech — Meticulously architected web applications')
    ->title(
        default: 'ArchTech — Meticulously architected web applications',
        modify: fn (string $title) => $title . ' | ArchTech'
    )
    ->description(default: 'We are a development agency ...')
    ->image(default: fn () => asset('header.png'))
    ->flipp('blog', 'o1vhcg5npgfu')
    ->twitterSite('@archtechx');

public function show(Post $post)
{
    seo()
        ->title($post->title)
        ->description(Str::limit($post->content, 50))
        ->flipp('blog', ['title' => $page->title, 'content' => $page->excerpt]);

    return view('blog.show', compact($post));
}

<meta name="facebook-title" content="@seo('facebook.foo')">

seo()->extension('facebook', view: 'my-component');
// The extension will use <x-my-component>

seo()->facebookFoo('bar');
seo()->facebookTitle('About us');
seo()->set('facebook.description', 'We are a web development agency that ...');
seo(['facebook.description' => 'We are a web development agency that ...']);

seo()->extension('facebook', false);

php artisan seo:generate-favicons public/path-to/logo.png