forked from LiveCarta/PayPal-PHP-SDK
Fix path in bootstrap for samples when installed via composer
When installing the SDK as recommended via composer, the samples don't work because it can not find the autloader of composer
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Sample bootstrap file.
|
||||
*/
|
||||
|
||||
// Include the composer autoloader
|
||||
if(!file_exists(__DIR__ .'/vendor/autoload.php')) {
|
||||
echo "The 'vendor' folder is missing. You must run 'composer update --no-dev' to resolve application dependencies.\nPlease see the README for more information.\n";
|
||||
exit(1);
|
||||
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
|
||||
if (file_exists($composerAutoload))
|
||||
{
|
||||
$composerAutoload = __DIR__ .'/vendor/autoload.php';
|
||||
|
||||
if(!file_exists(__DIR__ .'/vendor/autoload.php')) {
|
||||
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
require $composerAutoload;
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
Reference in New Issue
Block a user