1. Go to this page and download the library: Download bankiru/seo-engine 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/ */
bankiru / seo-engine example snippets
// Instantiate TargetRepository
$targetRepository = new StaticTargetRepository();
// Fill it with $targetRepository->add($target);
// Instantiate PageRepository
$pageRepository = new StaticPageRepository();
// Fill page pairs with $pageRepository->add($target, $page);
// Instantiate target sorter
$sorter = new MatchScoreTargetSorter($targetRepository);
// Instantiate matcher
$matcher = new DestinationMatcher($sorter, $pageRepository);
// Create the destination to match
// The general approach is to hook into request processing and create it
// from incoming HTTP request
$destination = new Destination(
'/blog/articles/123',
[
'page_id' => 123,
'language' => 'en',
'category' => 'programming'
]
);
// Obtain matching SEO page for destination. Or handle a matching exception
try {
$page = $matcher->match($destination);
} catch (MatchingException $e) {
// you probably also wan't to set proper headers here
echo "Not found";
exit();
}
// Do whatether you want to render $page as HTML response properly.