autoload.php 438 B

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