PHP code example of setono / sylius-seo-plugin

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

    

setono / sylius-seo-plugin example snippets


# config/bundles.php

return [
    // ...
    Setono\SyliusSEOPlugin\SetonoSyliusSEOPlugin::class => ['all' => true],
];


declare(strict_types=1);

namespace App\Entity\Channel;

use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusSEOPlugin\Model\ChannelInterface;
use Setono\SyliusSEOPlugin\Model\ChannelTrait;
use Sylius\Component\Core\Model\Channel as BaseChannel;

#[ORM\Entity]
#[ORM\Table(name: 'sylius_channel')]
class Channel extends BaseChannel implements ChannelInterface
{
    use ChannelTrait;
}

use Setono\SyliusSEOPlugin\DataMapper\Product\ProductDataMapperInterface;
use Spatie\SchemaOrg\Product;
use Sylius\Component\Core\Model\ProductVariantInterface;

final class MpnProductDataMapper implements ProductDataMapperInterface
{
    public function map(ProductVariantInterface $productVariant, Product $product): void
    {
        // enrich the generated Schema.org Product with your own data
        $product->mpn($productVariant->getCode());
    }
}
shell
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate -n