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.
- PHP 5.2.x or higher
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.
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();
?>
The universal selector *
allows you to select all files in a folder:
foo/*.php
will select all PHP files in the directoryfoo/
foo/*/bar.php
will 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
The whole configuration of Bazinga is done by the config array.
mode
can be:AUTO
[default] enables the auto class detectionMANUAL
paths 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
Please submit issues through the issue tracker on GitHub. Your help is appreciated.
Bazinga 1.1 - 10/03/2012
release
Second alpha versionfeature
Now you can define static file pathsfeature
Addeddirname
absolute directory pathchange
Removedstrtolower
functionbug
Autoloader static class bug
Bazinga 1.0 - 06/01/2012
release
First alpha version
Bazinga 0.8 - 04/01/2012
release
First internal alpha versionupdate
Made class static
Bazinga 0.5 - 03/01/2012
release
First internal alpha versionupdate
Small documentation
Copyright (c) 2012 - Programmed by Christian Metz
Released under the BSD License.