jamm/autoload

Class to organize autoloading by PHP naming conventions and PSR-0 standard

dev-master 2013-07-22 14:35 UTC

This package is not auto-updated.

Last update: 2024-11-23 12:56:57 UTC


README

Class to organize autoloading by PHP naming conventions and PSR-0 standard:

  • A fully-qualified namespace and class must have the following structure \<Vendor Name>\(<Namespace>\)*<Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
  • The fully-qualified namespace and class is suffixed with ".php" when loading from the file system.
  • Alphabetic characters in vendor names, namespaces, and class names may be of any combination of lower case and upper case.

How to use

  • Classes of all packages (libraries), placed in the "vendors" folder, will be autoloaded automatically (in first use);
  • You can map namespace of package, placed in any folder: use register_namespace_dir() method;
  • You can map any class also: use register_class() method;

License: MIT