Advertisement
Guest User

find autoloader

a guest
Sep 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. $requireAutoloader = function() {
  2.     $autoloaderLocations = [
  3.         __DIR__ . '/../../autoload.php',
  4.         __DIR__ . '/../vendor/autoload.php',
  5.         __DIR__ . '/vendor/autoload.php'
  6.     ];
  7.     foreach($autoloaderLocations as $location) {
  8.         if(is_file($location)) {
  9.             require_once $location;
  10.             return;
  11.         }
  12.     }
  13.     fprintf(STDERR, 'You must set up the project dependencies using `composer install`' . PHP_EOL);
  14.     fprintf(STDERR, "See https://getcomposer.org/download/ for instructions on installing Composer" . PHP_EOL);
  15.  
  16.     exit(1); // General error.
  17. };
  18. $requireAutoloader();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement