pdo - PHP Custom Class, PayPal API, Mailgun API, Easypost API. Can they work together -
i have ecommerce site building client. site had worked fine using procedural functions , curl make calls paypal. download mailgun , easypost api manual , installed manually. down road, wanted update site utilize pdo & oop. have done fair job @ getting foundation laid. time start making calls various api's.i installed using composer , run dual autoloader. composer autoload , beneath custom autoload load classes. now, when call on paypal api, following error:
fatal error: class 'paypal\rest\apicontext' not found in /var/www/html/myla-dev/shoppingcartfinalize.php on line 18
i think happening autoloader trying load rather composers autoloader. here autoloading occurring:
init.php
require __dir__.'/core/functions/general.php'; function autoloader ($class) { if (file_exists(__dir__.'/core/classes/'.$class.'.php')) { require __dir__.'/core/classes/'.$class.'.php'; } } spl_autoload_register('autoloader'); require __dir__.'/vendor/autoload.php';
this file sits in project root directory , required @ top of every file.
file structure
core --classes ----alert.php ----.... --functions ----general.php vendor --composer --easypost --guzzle --mailgun --symfony --paypal --autoload.php index.php init.php ...
composer.json
{ "repositories": [ { "type": "vcs", "url": "https://github.com/easypost/easypost-php" } ], "require": { "php": ">=5.3.0", "easypost/easypost-php": "dev-master", "ext-curl": "*", "ext-json": "*", "paypal/rest-api-sdk-php":"*", "mailgun/mailgun-php": "dev-master" } }
any , assistance appreciated. if feel writing code, great, not asking for. job, reworking make work awesome.
thanks
it ended being simple syntax error. after dumped , updated composer still failed work, copied code installation wiki. worked composer code mine , missing backslash in call wiki. thank assistance though.
Comments
Post a Comment