PHP code example of 3brs / sylius-payment-restrictions-plugin

1. Go to this page and download the library: Download 3brs/sylius-payment-restrictions-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/ */

    

3brs / sylius-payment-restrictions-plugin example snippets


    return [
       ...
       ThreeBRS\SyliusPaymentRestrictionPlugin\ThreeBRSSyliusPaymentRestrictionPlugin::class => ['all' => true],
    ];
    

        

        declare(strict_types=1);

        namespace Tests\ThreeBRS\SyliusPaymentRestrictionPlugin\Entity;

        use Doctrine\Common\Collections\ArrayCollection;
        use Doctrine\ORM\Mapping as ORM;
        use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod;
        use ThreeBRS\SyliusPaymentRestrictionPlugin\Model\PaymentMethodRestrictionInterface;
        use ThreeBRS\SyliusPaymentRestrictionPlugin\Model\PaymentMethodRestrictionTrait;

        #[ORM\Entity]
        #[ORM\Table(name: 'sylius_payment_method')]
        class PaymentMethod extends BasePaymentMethod implements PaymentMethodRestrictionInterface
        {
            use PaymentMethodRestrictionTrait;

            public function __construct()
            {
                parent::__construct();

                $this->shippingMethods = new ArrayCollection();
            }
        }