I am trying to create object of class within function. But PHP keeps telling me, that class is not found. Class is defined in another file included via autoload. My code is:
require_once('inc/eet/autoload.php');
require_once('inc/eet/eet_functions.php');
use Ondrejnov\EET\Exceptions\ServerException;
use Ondrejnov\EET\Dispatcher;
use Ondrejnov\EET\Receipt;
use Ondrejnov\EET\Utils\UUID;
var_dump(sendEET(1111597719, 'eshop'));
Part of file eet_function.php is:
function sendEET ($number, $type){
$dispatcher = new Dispatcher(PRODUCTION_WSDL, 'xxx.key', 'xxx.pem');
....
}
And the error is:
Fatal error: Class 'Dispatcher' not found in /var/www/clients/client1/web3/web/inc/eet/eet_functions.php on line 14 E_ERROR Error in file »eet_functions.php« at line 14: Class 'Dispatcher' not found
Can you please help me sort it out? Thank you very much!