Bazinga
Powerful and lightweight bootstrap/autoloader class for PHP5.
Install / Use
/learn @cosenary/BazingaREADME
Bazinga!
About
Bazinga is a powerful and lightweight bootstrap class for PHP5.
It helps you to load all necessary classes in scripts.
Your feedback is always welcome.
Requirements
- PHP 5.2.x or higher
Quick Start
First include the Bazinga class: require 'Bazinga.php';
<?php
Bazinga::init(array(
'config' => array(
'mode' => 'AUTO',
'path' => 'include/files/'
),
'folder/*/*.php'
))->load();
new Foo();
new Bar();
?>
Then you are ready to start! Bazinga will load any other libraries for you.
If you work in the MANUAL mode, you have to define all class paths in the init array.
Details
If you like to set paths after initializing Bazinga, than make use of the setPath() method.
It accepts single path patterns as a string or multiple in an array.
To trigger the loading process, simply call the load() method.
This can be done by using the Scope Operator or Method Chaining.
<?php
Bazinga::init(array(
'config' => array(
'mode' => 'MANUAL'
)
));
Bazinga::setPath('include/*.php');
Bazinga::setPath(array(
'scripts/*/foo.php',
'bar.php'
));
Bazinga::load();
?>
Path patterns
The universal selector * allows you to select all files in a folder:
foo/*.phpwill select all PHP files in the directoryfoo/foo/*/bar.phpwill search in all subfolders offoo/for files namedbar.php
Of course it's also possible to define static file paths like: path/to/file.php
Config
The whole configuration of Bazinga is done by the config array.
modecan be:AUTO[default] enables the auto class detectionMANUALpaths to the include files have to be defined manually
path(only necessary in the AUTO mode) path to the directory where to search for classes
Issues
Please submit issues through the issue tracker on GitHub. Your help is appreciated.
History
Bazinga 1.1 - 10/03/2012
releaseSecond alpha versionfeatureNow you can define static file pathsfeatureAddeddirnameabsolute directory pathchangeRemovedstrtolowerfunctionbugAutoloader static class bug
Bazinga 1.0 - 06/01/2012
releaseFirst alpha version
Bazinga 0.8 - 04/01/2012
releaseFirst internal alpha versionupdateMade class static
Bazinga 0.5 - 03/01/2012
releaseFirst internal alpha versionupdateSmall documentation
Credits
Copyright (c) 2012 - Programmed by Christian Metz
Released under the BSD License.
