PHP code example of roberthucks / seo-magic

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

    

roberthucks / seo-magic example snippets




oberthucks\SEOMagic\SEOMagic;

$magic = new SEOMagic();



oberthucks\SEOMagic\SEOMagic;
use roberthucks\SEOMagic\Configuration;

//Change the cache mechanism to disable the cache
$configuration = Configuration::getInstance();
$configuration->cache = roberthucks\SEOMagic\Cacher\NullCache::class;

$magic = new SEOMagic();

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');

$magic = new SEOMagic();
$magic->cachePage('https://example.com');

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');
$magic->getHtml(); //<h1>Hello</h1>

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');
$magic->getHeaders(); //['content-type' => 'text/html']

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');
$magic->getResponseCode(); //200

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');
$magic->getRenderTime(); //1.56423

$magic = new SEOMagic();
$magic->fetchPage('https://example.com');
$magic->isFromCache(); //true