Symfony - Composer and Payone PHP SDK

592 Views Asked by At

I'm trying to use the PHP-SDK and I just can't get it to work. I'm not familiar with the use and namespace statements in PHP and I'm trying to understand it.

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "payone/php-sdk",
                "version": "1.0.0",
                "dist": {
                    "url": "http://github.com/PAYONE/PHP-SDK/archive/master.zip",
                    "type": "zip"
                },
                "autoload": {
                    "psr-0": { "Payone_": "php/" }
                }
            }
        }
    ],
    "require": {
        "payone/php-sdk": "1.0.*"
    }
}

As far as I understand this tries to load the Autoload.php in my payone/php-sdk/php folder with the class prefix Payone_. This seems fine to me but I can't use $builder = new Payone_Builder(); in my controller now. What am I doing wrong?

2

There are 2 best solutions below

1
On BEST ANSWER

You need to add the use statement to your controller.

use Payone_Builder;
0
On

as per 2015/03 new zip url

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "payone/php-sdk",
                "version": "1.0.0",
                "dist": {
                    "url": "http://www.payone.de/uploads/media/php-sdk.zip",
                    "type": "zip"
                },
                "autoload": {
                    "psr-0": {"Payone_": "php/"}
                }
            }
        }
    ]
}