Cradle  0.3.3
Simple library for creating Web-based applications
ClassLoader Class Reference

Digger Class Loader. More...

Static Public Member Functions

static register ($rootPath, $searchList=null)
 
static load ($class)
 

Static Public Attributes

static $rootPath = null
 
static $searchList = ['lib', 'controllers', 'models']
 

Detailed Description

Digger Class Loader.

Spesial auto loader for all Digger components

Version
3.0
Author
Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru

Example of usage:

// Your application structure:
//
// /application_root/
// ├─ src/ (PSR-4 class style)
// │ │
// │ ├── Class1.php
// │ ├── Class2.php
// │ ├── ...
// │ └── ClassN.php
// │
// └─ lib/ (PSR-0 class style)
// │
// └── vendor/
// └── package/
// ├── Class1.php
// ├── Class1.php
// ├── ...
// └── ClassN.php
require_once 'ClassLoader.php';
// PSR-0:
digger\cradle\common\ClassLoader::register('/application_root', [ 'lib' ]);
// PSR-4:
digger\cradle\common\ClassLoader::register('/application_root', ["vendor\\package\\" => 'src/']);
// Both (PSR-0 and PSR-4):
digger\cradle\common\ClassLoader::register('/application_root', ['lib', "vendor\\package\\" => 'src/']);

Member Function Documentation

static load (   $class)
static

Function to load a class

Parameters
string$classClass name for class to load.
Returns
boolean TRUE on success.
static register (   $rootPath,
  $searchList = null 
)
static

To register autoloader

Parameters
string$rootPathRoot path to start search the classes

Field Documentation

$rootPath = null
static

string Root path to search classes

$searchList = ['lib', 'controllers', 'models']
static

array Search list to find classes in specific directories


The documentation for this class was generated from the following file: