change the way to call autoload.php.
- As suggested by @theshka, this code first verify if Pico is being used as local composer install, then verify if it is being used as a composer library.
This commit is contained in:
parent
85442266b5
commit
70d813eafe
1 changed files with 10 additions and 8 deletions
18
index.php
18
index.php
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
$parent = '..' . DIRECTORY_SEPARATOR;
|
||||
set_include_path(
|
||||
get_include_path() . PATH_SEPARATOR .
|
||||
$parent . $parent . $parent . PATH_SEPARATOR .
|
||||
'.'
|
||||
);
|
||||
|
||||
// load dependencies
|
||||
require_once('vendor/autoload.php');
|
||||
if(is_file($f = __DIR__ . '/vendor/autoload.php')) {
|
||||
// local composer install
|
||||
require_once($f);
|
||||
} elseif(is_file($f = __DIR__ . '/../../../vendor/autoload.php')) {
|
||||
// root composer install
|
||||
require_once($f);
|
||||
} else {
|
||||
// composer needs install...
|
||||
die('Cannot find composer `/vendor/autoload.php` -- try `composer install`');
|
||||
}
|
||||
|
||||
// instance Pico
|
||||
$pico = new Pico(
|
||||
|
|
Loading…
Reference in a new issue