PHP Classes
elePHPant
Icontem

Galaxy Loader: Register class loaders based on file path rules

Recommend this page to a friend!
  Info   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2012-06-12 (4 years ago) RSS 2.0 feedNot enough user ratingsTotal: 332 All time: 6,759 This week: 1,123Up
Version License PHP version Categories
galaxy-loader 1.1MIT/X Consortium ...5.3PHP 5, Language
Description Author

This class can register class loaders based on file path rules.

It can add rules for one or more class loaders that define how class file path should be defined.

Currently it supports defining class file name extension and directory paths to lookup for class files.

An extended loader class can also define rules that determine how namespaces are mapped to class directory paths.

Previously defined class loaders or individual loader rules may also be removed.

The list of class to file mapping may be saved to files, so it can be loaded later for greater efficiency.

Picture of Sebastian Potasiak
  Performance   Level  
Name: Sebastian Potasiak <contact>
Classes: 8 packages by
Country: Poland Poland
Innovation award
Innovation award
Nominee: 3x

Details
Galaxy Loader v0.3
================

This package contains loaders classes and interfaces and abstractions, which 
will help you implement your own loader class.

There are two built-in loaders:

gfLoader
-------
* Registering library directories
* Registering class files extensions
* Creates full path changing namespace into relative file path
* Manual finding and laoding clsses
* Saving and loading classes maps

gfLoaderExtended
--------------
* Extends gfLoader, so has all it's features, excluding way it finds classes
* Registering namespaces and it's paths
* Creates full path checking available namespace paths

Example
------

    <?php
    require_once 'lib/gf/Loader/Exception.php';
    require_once 'lib/gf/Loader/gfLoaderInterface.php';
    require_once 'lib/gf/Loader/gfLoaderManualInterface.php';
    require_once 'lib/gf/Loader/gfLoaderMappableInterface.php';
    require_once 'lib/gf/Loader/gfLoaderAbstraction.php';
    require_once 'lib/gf/Loader/gfLoader.php';
    
    use \gf\Loader\gfLoader;
    use \gf\Loader\gfLoaderExtended;
    
    $Loader = new gfLoader();
    
    $Loader->registerDirectory('lib')
           ->registerExtension('php')
           ->register();
    
    $Extended = new gfLoaderExtended();
    
    $Extended->registerDirectory('lib')
             ->registerExtension('php')
             ->registerNamespace('gf\\Loader', 'gf/Loader/')
             ->register();
          
In this example you can see all of the basic functionalities of _Galaxy Loader_.
For more, look at comments in code.

Loaders are stacked in SPL autoload handlers stack, so when you are registering
a new loader, the old one is not unregistered. To unregister loader use:
    
    $Loader->unregister();
    
More information about every class and developing your own implementations
comming soon.
  Files folder image Files  
File Role Description
Files folder imagelib (1 directory)
Accessible without login Plain text file LICENSE Lic. Package license (MIT)
Accessible without login Plain text file README.md Doc. Readme file

  Files folder image Files  /  lib  
File Role Description
Files folder imagegf (1 directory)

  Files folder image Files  /  lib  /  gf  
File Role Description
Files folder imageLoader (7 files)

  Files folder image Files  /  lib  /  gf  /  Loader  
File Role Description
  Plain text file Exception.php Class Exception class for Galaxy Loader
  Plain text file gfLoader.php Class Default loader class
  Plain text file gfLoaderAbstraction.php Class Loader class abstraction
  Plain text file gfLoaderExtended.php Class Extended default loader class
  Plain text file gfLoaderInterface.php Class Loader class interface
  Plain text file gfLoaderManualInterface.php Class Manual loading interface
  Plain text file gfLoaderMappableInterface.php Class Class mapping interface

 Version Control Unique User Downloads Download Rankings  
 100%
Total:332
This week:0
All time:6,759
This week:1,123Up