1

I am trying to install Mangopay https://github.com/Mangopay/mangopay2-php-sdk, but the recommended solution of installing it without composer doesn't work. I used this line:

require_once "mango/mangopay2-php-sdk-2.11.0/MangoPay/Autoloader.php";
$api = new MangoPay\MangoPayApi();

The file get's loaded, but I get the following error:

Fatal error: Uncaught Error: Class 'Psr\Log\NullLogger' not found in 
/usr/local/apache2/htdocs/MangoPay/MangoPayApi.php:223 Stack trace: 
#0 /usr/local/apache2/htdocs/pay.php(5): MangoPay\MangoPayApi- 
>__construct() #1 {main} thrown in 
/usr/local/apache2/htdocs/MangoPay/MangoPayApi.php on line 223

The issue is with the logger, which I manually downloaded and copied into the directory but it still doesn't work. I am only asking here because I am not getting any response from the developers.

Any help with manually installing the logger and getting the namespace to work with mangopay is welcome.

dfhdfh
  • 35
  • 1
  • 6
  • There's an "_Alternatively you can download the package in its entirety (ie with all required dependencies)_" section on that GitHub page, have you tried that? Why not use composer though? – brombeer Apr 25 '19 at 08:52
  • You should not use an absolute path to include your autoloader; different environments (your test environment, the live environment) will have different paths to your project so you have to account for that or use a relative path instead. – jeroen Apr 25 '19 at 08:53
  • @jeroen The autoloader file is loaded fine, I checked, so the path should be fine. – dfhdfh Apr 25 '19 at 09:03
  • @kerbholz Yes, I downloaded the mangopay files from their github and logger separately. I don't want to use composer for production environment in multiple docker instances. Just want to have simple static files. – dfhdfh Apr 25 '19 at 09:03
  • If you downloaded them separately you might want to try the "alternative" way I was mentioning. – brombeer Apr 25 '19 at 09:28
  • @kerbholz I downloaded the whole package again, changed the code and I get the same issue. I edited the question above to reflect the code. The problem is on where to place psr/log files and how to initialise it – dfhdfh Apr 25 '19 at 09:49
  • Ok, you seem to still be using the wrong autoload. The only "whole" package I found on their releases page was `mangopay2-php-sdk-2.5.0.zip`. Download and extract it to your project folder. In your project folder have an `index.php`, add `require_once 'mangopay2-php-sdk-2.5.0/vendor/autoload.php';` as it says in the documentation and you're good to go. The "whole" package includes a `vendor` folder, where all dependencies are already stored. – brombeer Apr 25 '19 at 10:05
  • @kerbholz Solved, thank you very much... Didn't see any distinction between the releases before. – dfhdfh Apr 25 '19 at 10:47
  • Yeah, took me some time myself to find that package. Glad it works – brombeer Apr 25 '19 at 10:48
  • Please add this as an answer, so other's can find it easily – dbrumann Apr 26 '19 at 12:53

0 Answers0