1. Go to this page and download the library: Download wizardstool/seo-audit 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/ */
wizardstool / seo-audit example snippets
ardstool\SeoAudit\AuditBuilder;
use Wizardstool\SeoAudit\Audits\DescriptionAudit;
use Wizardstool\SeoAudit\Audits\CanonicalUrlAudit;
use Wizardstool\SeoAudit\Audits\TitleAudit;
use Wizardstool\SeoAudit\AuditIssues;
$subAudits = [
new TitleAudit(),
new DescriptionAudit(),
new CanonicalUrlAudit(),
];
$html = <<<'HTML'
<html>
<head>
<title>This is title</title>
<meta name="description" content="This is document with description." />
<link rel="canonical" href="https://my-second-url-for-test.com">
</head>
</html>
HTML;
$audit = new AuditBuilder('https://my-url-for-test.com', $html, $subAudits);
$audit->run();
$result = $audit->getAuditResult();
var_dump($result);
$result = $audit->getAuditResult();
$titleTooShortResult = $result->getIssues()['seo'][TitleAudit::class][AuditIssues::TITLE_TOO_SHORT];
if (isset($titleTooShortResult['length'])) {
echo sprintf('Title "%s" is too short, its length %d. It should be atleast %d characters.', $result->getTitle(),
$titleTooShortResult['length'], (new TitleAudit())->getTitleMinLength());
}
$titleAudit = new TitleAudit();
// setup custom title limits
$titleAudit->setTitleMinLength(45);
$titleAudit->setTitleMaxLength(70);
$subAudits = [
$titleAudit,
new DescriptionAudit(),
new CanonicalUrlAudit(),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.