PHP code example of astroanu / laravel-seo-gen

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

    

astroanu / laravel-seo-gen example snippets

`
abstract class Controller extends BaseController {

	protected $metaData;

	public function __construct()
	{
		$this->metaData = new \Astroanu\SEOGen\Data();		
	}

}
`
$this->metaData->title = 'Welcome';
$this->metaData->description = 'Some demo text here for you to see';
$this->metaData->robots = 'noindex,nofollow';
$this->metaData->image = 'http://www.sample.com/image.jpg';

return view('welcome', ['metaData' => $this->metaData]);
`
 \Astroanu\SEOGen\Renderer::render($metaData); 
`
// config

return 	array(

	'meta' => [
	
		'default_title' => 'My App',
		'concat_default_title' => true,
		'concat_with' => ' : '

	],

	'social' => [

		'og' => [
			'render' => true,
			'additional_og_tags' => ['fb__app_id', 'test_tag']
		],
		
		'twitter' => [
			'render' => true
		]

	]
	
);

// controller

$this->metaData->title = 'Welcome';
$this->metaData->description = 'Some demo text here for you to see';
$this->metaData->robots = 'noindex,nofollow';
$this->metaData->image = 'http://www.sample.com/image.jpg';
$this->metaData->fb__app_id = '456456456456'; // double underscore will be treated as a namespace
$this->metaData->test_tag = 'test text'; // this will still render as a meta tag

return view('welcome', ['metaData' => $this->metaData]);