Question

I am using ZF2, and i need to now use Paymill payment service, they have it available here: https://github.com/Paymill/Paymill-PHP

Should i download it and place it in my module/application/src? or it should be anywhere and then only apply in controllers : require './paymill-php/autoload.php'; ?

Or is there any existing ZF2 adapter already for paymill?

Was it helpful?

Solution

If you are using composer, you can easily include paymill in your composer.json and execute composer update to update the autoload.php.

In your composer.json, just add

{
    "require": {
        "paymill/paymill": "v3.0.0"
    }
}

You may also want to read about how to get started with composer : https://getcomposer.org/doc/00-intro.md

By executing composer update, composer will download paymill and its dependencies into your vendor directory. After that, If you are using ZF2 with composer, you can use simply use paymill in your controller, for example:

// in your controller
$request = new \Paymill\Request($apiKey);
$payment = new \Paymill\Models\Request\Payment();
$payment->setToken("yourtoken");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top