autoload.php 534 B

123456789101112131415161718192021
  1. <?php
  2. $vendors = __DIR__.'/vendor/autoload.php';
  3. if (file_exists($vendors)) {
  4. return require $vendors;
  5. }
  6. /*
  7. * Registers an autoload for all the classes in Gregwar\Image
  8. */
  9. spl_autoload_register(function ($className) {
  10. $namespace = 'Gregwar\\Image';
  11. if (strpos($className, $namespace) === 0) {
  12. $className = str_replace($namespace, '', $className);
  13. $fileName = __DIR__.'/'.str_replace('\\', '/', $className).'.php';
  14. if (file_exists($fileName)) {
  15. require $fileName;
  16. }
  17. }
  18. });