PHP code example of payplug / sylius-payplug-plugin
1. Go to this page and download the library: Download payplug/sylius-payplug-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/ */
payplug / sylius-payplug-plugin example snippets
declare(strict_types=1);
namespace App\Entity\Customer;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\CustomerTrait;
use Sylius\Component\Core\Model\Customer as BaseCustomer;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_customer")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_customer')]
class Customer extends BaseCustomer
{
use CustomerTrait;
}
declare(strict_types=1);
namespace App\Entity\Payment;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentMethodTrait;
use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod;
use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment_method")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment_method')]
class PaymentMethod extends BasePaymentMethod
{
use PaymentMethodTrait;
protected function createTranslation(): PaymentMethodTranslationInterface
{
return new PaymentMethodTranslation();
}
}
declare(strict_types=1);
namespace App\Entity\Payment;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentTrait;
use Sylius\Component\Core\Model\Payment as BasePayment;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_payment")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_payment')]
class Payment extends BasePayment
{
use PaymentTrait;
}