PHP code example of mangoweb-sylius / sylius-payment-restrictions-plugin

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

    

mangoweb-sylius / sylius-payment-restrictions-plugin example snippets


   return [
      ...
      MangoSylius\PaymentRestrictionPlugin\MangoSyliusPaymentRestrictionPlugin::class => ['all' => true],
   ];
   

    
   
   declare(strict_types=1);
   
   namespace App\Entity\Payment;
   
   use Doctrine\Common\Collections\ArrayCollection;
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\Payment as BasePayment;
   use MangoSylius\PaymentRestrictionPlugin\Model\PaymentMethodRestrictionInterface;
   use MangoSylius\PaymentRestrictionPlugin\Model\PaymentMethodRestrictionTrait;
   
   /**
    * @ORM\Entity
    * @ORM\Table(name="sylius_payment")
    */
   class PaymentMethod extends BasePayment implements PaymentMethodRestrictionInterface
   {
       use PaymentMethodRestrictionTrait;
   
       public function __construct()
       {
           parent::__construct();
       
           $this->shippingMethods = new ArrayCollection();
       }
   }