1. Go to this page and download the library: Download grouphub/seotools 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/ */
grouphub / seotools example snippets
// file START ommited
'providers' => [
// other providers ommited
'Grouphub\Seotools\Providers\SEOToolsServiceProvider',
],
// file END ommited
// file START ommited
'aliases' => [
// other Facades ommited
'SEOMeta' => 'Grouphub\Seotools\Facades\SEOMeta',
'OpenGraph' => 'Grouphub\Seotools\Facades\OpenGraph',
'Twitter' => 'Grouphub\Seotools\Facades\TwitterCard',
// or
'SEO' => 'Grouphub\Seotools\Facades\SEOTools',
],
// file END ommited
use Grouphub\Seotools\Traits\SEOTools as SEOToolsTrait;
class CommomController extends Controller
{
use SEOToolsTrait;
/**
* @return \Illuminate\View\View
*/
public function index()
{
$this->seo()->setTitle('Home');
$this->seo()->setDescription('This is my page description');
$this->seo()->opengraph()->setUrl('http://current.url.com');
$this->seo()->opengraph()->addProperty('type', 'articles');
$this->seo()->twitter()->setSite('@LuizVinicius73');
$posts = Post::all();
return view('myindex', compact('posts'));
}
}
OpenGraph::addProperty($key, $value); // value can be string or array
OpenGraph::addImage($url); // add image url
OpenGraph::addImages($url); // add an array of url images
OpenGraph::setTitle($title); // define title
OpenGraph::setDescription($description); // define description
OpenGraph::setUrl($url); // define url
OpenGraph::setSiteName($name); //define site_name
// You can chain methods
OpenGraph::addProperty($key, $value)
->addImage($url)
->addImages($url)
->setTitle($title)
->setDescription($description)
->setUrl($url)
->setSiteName($name);
// Generate html tags
OpenGraph::generate();
Twitter::addValue($key, $value); // value can be string or array
Twitter::setType($type); // type of twitter card tag
Twitter::setTitle($type); // title of twitter card tag
Twitter::setSite($type); // site of twitter card tag
Twitter::setDescription($type); // description of twitter card tag
Twitter::setUrl($type); // url of twitter card tag
Twitter::addImage($url); // add image url
Twitter::addImages($url); // add an array of url images
// You can chain methods
Twitter::addValue($key, $value)
->setType($type)
->addImage($url)
->addImages($url)
->setTitle($title)
->setDescription($description)
->setUrl($url)
->setSite($name);
// Generate html tags
Twitter::generate();