autoload.app.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Your Application's PHP classes auto-loading
  5. |
  6. | All classes in PIMF are statically mapped. It's just a simple array of
  7. | class to file path maps for ultra-fast file loading.
  8. |--------------------------------------------------------------------------
  9. */
  10. spl_autoload_register(
  11. function ($class) {
  12. // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  13. // FEEL FREE TO CHANGE THE MAPPINGS AND DIRECTORIES
  14. // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  15. /**
  16. * The mappings from class names to file paths.
  17. */
  18. static $mappings = array(
  19. 'Vanilla\\Controller\\Hello' => '/Vanilla/Controller/Hello.php',
  20. 'Vanilla\\DataMapper\\Fortune' => '/Vanilla/DataMapper/Fortune.php',
  21. 'Vanilla\\DataMapper\\World' => '/Vanilla/DataMapper/World.php',
  22. );
  23. // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  24. // END OF USER CONFIGURATION!!!
  25. // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  26. // load the class from the static heap of classes.
  27. if (isset($mappings[$class])) {
  28. return require __DIR__ . DIRECTORY_SEPARATOR . $mappings[$class];
  29. }
  30. return false;
  31. }
  32. );