1. Go to this page and download the library: Download dakataa/seo 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/ */
dakataa / seo example snippets
namespace App\Controller;
use Dakataa\Seo\Attribute\Breadcrumb\BreadcrumbItem;use Dakataa\Seo\Attribute\Meta;
use Dakataa\Seo\Attribute\Title;
use Dakataa\Seo\Service\Breadcrumb;use Dakataa\Seo\Service\Metadata;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class FrontController extends AbstractController {
#[Title('Homepage')]
#[Meta('description', 'Welcome to my SEO Homepage')]
#[Route]
public function index() {
}
#[Route('/products')]
public function products(Metadata $metadata, Breadcrumb $breadcrumb) {
$metadata
->setTitle('Second way to set Page Title')
->setMeta([new Meta('description', 'Product Page')]);
// Add breadcrumb
$breadcrumb->add(new BreadcrumbItem('Products'));
}
#[Title('Products')]
#[Meta('description', 'Welcome to my SEO Homepage')]
#[BreadcrumbItem('Products')]
#[BreadcrumbItem('{product}')]
#[Route('/products/view/{id}')]
#[Entity('product', expr: 'repository.findById(id)', class: Product::class)]
public function productView(Metadata $metadata, $product) {
$metadata->setTitle('Second way to set Page Title');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.