2017 © Pedro Peláez
 

library autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

image

redcatphp/autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  • Thursday, March 16, 2017
  • by surikat
  • Repository
  • 2 Watchers
  • 7 Stars
  • 446 Installations
  • PHP
  • 1 Dependents
  • 2 Suggesters
  • 3 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

No longer actively maintained. I work now with NodeJS and I recommand you to take a look at di-ninja, (*1)

# Autoload - PHP native dependency manager

Autoload is a simple and concise PHP Autoloader based on universal conventions.
No more need of annoying "require_once" at start of each php file. When needed by php code the class will be dynamicaly loaded and no more load of unused class, increasing performances in same time.
This component is able to autoload all modern PHP frameworks and libraries like Zend, Symfony, PEAR, Aura or many others., (*2)

  • PSR-4
  • PSR-0 (retrocompat)
  • classMap API
  • include_path support
  • HHVM hack
  • empty namespace support for root autoload path
  • cache for checked class_exists

Methods usage

simple facade API using global instance

use RedCat\Autoload\Autoload;
/* register "MyNamespace\SubSpace" prefix to "myDirectory/src/myNamespacePath" directory */
Autoload::register('myDirectory/src/myNamespacePath','MyNamespace\SubSpace');

/* register the containing file directory as a root directory for autoload */
Autoload::register(__DIR__);
/* equivalent */
Autoload::register(__DIR__,'');

get global instance

$autoload = Autoload::getInstance();

register and unregister to SPL stack

$autoload->splRegister();
$autoload->splUnregister();

add namespaces

$autoload->addNamespace('Prefix\Of\My\Namespace','target/directory');
$autoload->addNamespace('Prefix\Of\My\Namespace2',[
    'target/directory1',
    'target/directory2',
]);
$autoload->addNamespaces([
    'Prefix\Of\My\Namespace'=>'target/directory/for/my/namespace',
    'Prefix\Of\My\Namespace2'=>[
        'target/directory1',
        'target/directory2',
    ]
]);

useIncludePath

$autoload->useIncludePath(true); //default param to true but default property to false

useCache

$autoload->useCache(false); //default param and property to true

addClass and addClassMap

$autoload->addClass('My\Class','path/of/myclass.php');
$autoload->addClassMap([
    'My\Class'=>'path/of/myclass.php',
    'My\Class2'=>'path/of/myclass2.php',
]);

The Versions

16/03 2017

dev-master

9999999-dev http://redcatphp.com/autoload-psr4

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

16/03 2017

v2.3.2

2.3.2.0 http://redcatphp.com/autoload-psr4

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

16/03 2017

v2.3.1

2.3.1.0 http://redcatphp.com/autoload-psr4

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

16/03 2017

v2.3.0

2.3.0.0 http://redcatphp.com/autoload-psr4

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

08/11 2015

v2.2

2.2.0.0 https://github.com/redcatphp/Autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

22/10 2015

v2.1

2.1.0.0 https://github.com/surikat/Autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

23/08 2015

v2.0

2.0.0.0 https://github.com/surikat/Autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4

20/08 2015

v1.1

1.1.0.0 https://github.com/surikat/Autoload

Autoload - Simple and Concise PHP Autoloader - PSR-4 convention

  Sources   Download

LGPL-3.0+ CC0-1.0

The Requires

  • php >=5.4.0

 

autoload psr-4