Im trying to use the HiPay php library. I installed the library with:
composer require hipay/hipay-fullservice-sdk-php
Resulting in a vendor directory with the HiPay library in it. In my order.php page I use
<?php
namespace TokenizationExample;
require __DIR__ . '/config/credentials.php';
require __DIR__ . '/vendor/autoload.php';
$config = new \HiPay\Fullservice\HTTP\Configuration\Configuration($credentials['private']['username'], $credentials['private']['password']);
but I get i Class Not Found error on
$config = new \HiPay\Fullservice\HTTP\Configuration\Configuration($credentials['private']['username'], $credentials['private']['password']);
It works on my local win 10 computer running XAMPP but it dont work when I upload the code to my hosting. I have check for missmatches in filnames but I cant spot the whats wrong.
This is the error:
Fatal error: Uncaught Error: Class 'HiPay\Fullservice\HTTP\Configuration\Configuration' not found in /home/XXXXX/order.php:8 Stack trace: #0 {main} thrown in /home/XXXXX/order.php on line 8
and the vendor dir created by composer
but how can I figure out what is wrong? And debug autoload.php? Sorry for newbie questions. Im a newbie at PHP
Update 1:
I did a "print_r" of the aulotloader
$autoloader = require __DIR__ . '/vendor/autoload.php';
print_r($autoloader,true)
and got this result from the hosting site were it doesnt work
Composer\Autoload\ClassLoader Object
(
[prefixLengthsPsr4:Composer\Autoload\ClassLoader:private] => Array
(
[H] => Array
(
[HiPay\Fullservice\] => 18
)
)
[prefixDirsPsr4:Composer\Autoload\ClassLoader:private] => Array
(
[HiPay\Fullservice\] => Array
(
[0] => /home/XXXXX/vendor/composer/../hipay/hipay-fullservice-sdk-php/lib/HiPay/Fullservice
)
)
[fallbackDirsPsr4:Composer\Autoload\ClassLoader:private] => Array
(
)
[prefixesPsr0:Composer\Autoload\ClassLoader:private] => Array
(
)
[fallbackDirsPsr0:Composer\Autoload\ClassLoader:private] => Array
(
)
[useIncludePath:Composer\Autoload\ClassLoader:private] =>
[classMap:Composer\Autoload\ClassLoader:private] => Array
(
)
[classMapAuthoritative:Composer\Autoload\ClassLoader:private] =>
[missingClasses:Composer\Autoload\ClassLoader:private] => Array
(
)
[apcuPrefix:Composer\Autoload\ClassLoader:private] =>
)
the only difference between the not working and working local XAMPP sites print_r output is
[prefixDirsPsr4:Composer\Autoload\ClassLoader:private] => Array
(
[HiPay\Fullservice\] => Array
(
[0] => C:\xampp\htdocs\hipay-example\vendor\composer/../hipay/hipay-fullservice-sdk-php/lib/HiPay/Fullservice
)
)
so I renamed the HiPay folder to hipay and everythings works. Lesson learned, use "print_r" to debug your autoloder fckps