PHP code example of momocode / shopware-6-plugin-base

1. Go to this page and download the library: Download momocode/shopware-6-plugin-base 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/ */

    

momocode / shopware-6-plugin-base example snippets




namespace MyPlugin;

use Momocode\Shopware6Base\Plugin;

// Autload extra dependencies
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    

 declare(strict_types=1);

namespace YourPlugin\Migration;

use Momocode\Shopware6Base\Migration\MailTypeMigration;
use Shopware\Core\Framework\Uuid\Uuid;

class Migration1586007577NewMailTypes extends MailTypeMigration
{

    public function getCreationTimestamp(): int
    {
        return 1586007577;
    }

    protected function getMailTypeMapping(): array
    {
        return [
            'your_technical_template_name' => [
                'id' => Uuid::randomHex(),
                'name' => 'Your english template description',
                'nameDe' => 'Deine deutsche Beschreibung',
                'availableEntities' => json_encode(['salesChannel' => 'sales_channel']),
            ],
        ];
    }
}