namespace and require_once amazonpay

40 Views Asked by At

i am trying to use amazonpay and encounter the following problem;

when i if ($whatever) require_once("amazonpay_stuff.php") with content:

namespace AmazonPay
require_once "apay/config.php";
include 'apay/amazon-pay.phar';

and then in the same file where i have the require i try to use

$client = new Client($amazonpay_config);

this does not work and i get error message

Fatal error: Class 'Client' not found in ....

when i have all that code in one file;

namespace AmazonPay
require_once "apay/config.php";
include 'apay/amazon-pay.phar';
$client = new Client($amazonpay_config);

it works fine - how can i make it work with require_once?

0

There are 0 best solutions below