PHP code example of yapro / seo-bundle

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

    

yapro / seo-bundle example snippets


class MyController extends AbstractController
{
    /**
     * @Route("/article/{id}", methods={"GET"})
     */
    public function article(
        Article $article
        ContentManager $contentManager
    ): Response {
        $textWithSeoLinks = $contentManager->getSafeHtmlWithSeoLinks($article->getText());
        return new Response($textWithSeoLinks);
    }
}

/**
 * @Route("/redirect/page", methods={"GET"})
 */
public function seoRedirect(Request $request, LinkManager $linkManager): Response
{
    $redirect = $linkManager->getRedirect($request->getRequestUri());
    if ($redirect->getHttpStatus() === 200) {
        return new Response('<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $redirect->getUrl() . '">', 404);
    }
    throw $this->createNotFoundException('Redirect page not found');
}
sh
wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.8.0/php-cs-fixer.phar && chmod +x ./php-cs-fixer.phar
docker run --user=1000:1000 --rm -v $(pwd):/app -w /app yapro/seo-bundle:latest ./php-cs-fixer.phar fix --config=.php-cs-fixer.dist.php -v --using-cache=no --allow-risky=yes