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:
hakito
2013-10-06 20:49:49 +02:00
parent 6087461192
commit c1298112fa

View File

@@ -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;