It is now possible to disable the modules and the events system using the config file. This will completely turn the system off.
The event system will still load the event classes but it will not send them around.
If the $keepInstance = true variable is provided for Libraries::get() or Libraries::getDriver() then a new instance will be created and returned to the user.
If the $keepInstance = false (default) is provided then the same instance will be returned as the first one.
By changing the config.core.php file you can select how registries should be cached. Remember that this is not recommended during development.
The available options are file, apc, redis, memcached, wincache and dummy. Cache TTL can also be set. Some caching drivers require you to change the config.cache.php file.
The library comes with 6 drivers: APC, file, memcached, redis, wincache and a dummy driver. Which driver you can use is dependant on your situation.
In order to build this a Driver library has been implemented. A driver can be called using (FuzeWorks\)Libraries::getDriver($libraryName); This will load the driver library and the requested library. Regular library rules apply.
Every driver comes with the same methods (found in documentation) but the 2 most important are $driver->save($objectName, $object, $time); whereby $time is an integer in minutes; and $driver->get($objectName); which will receive the cached value;
To load a cache driver you need to run something like the following:
$cache = FuzeWorks\Libraries::getDriver('cache', array('adapter' => 'apc', 'backup' => 'file'));
This will try and load the APC cache driver. If this fails it will try and load the file driver. If all fails it will load the dummy driver. The dummy driver does not actually save anything, it's just a placeholder until you fix your environment.
More information can be found in the documentation.
Helpers are small utilities that can be loaded to assist a performing certain functions. Helpers are simply global functions that get loaded when requesting them.
Helpers can be loaded using (\FuzeWorks\)Helpers::load('helperName'); Helpers can be put in the 'Core/Helpers' or the 'Application/Helpers' directory. The 'Applications/Helpers' directory is scanned first, so this one has priority over Core helpers.
It is possible to sort of 'extend' helpers. By putting a helper in the 'Application/Helpers' directory with the application prefix (found in config.main.php) you can load that helper first and then the helper in the core directory. This allows you to add or override functions without the need of copying the entire helper from the core. For example: there is a helper in the core directory named 'example_helper.php'. This one has a function named 'doSomething();' inside it. If you now create a helper in the application directory named 'MY_example_helper.php', then that one will be loaded first and can override the core class because the application helper is loaded first.
More detailed instructions will be provided in the documentation.
Libraries are small one-class utilities which can be loaded to fasten functionality for controllers and modules. It's meant to support modules and controllers but not the other way around.
Libraries can be put in the Core/Libraries directory. Libraries put here must use the FuzeWorks\Library namespace and must use the 'FW_' prefix. A library named 'Example' will be named 'FW_Example' and would be located in the file Example.php in the Core/Libraries directory.
It's also possible to extend on core libraries or completely add new libraries. Adding a new library can be done as easily as adding the file to the Application/Libraries folder. The used namespace is 'Application\Library'. Libraries that do not extend anything do not need a prefix.
Libraries that extend however require a prefix. This prefix is configurable in the config.main.php in the Application/Config directory. The default prefix is 'MY_'. If you want to extend the file should have a different name. In the 'Example' example the file should be named 'MY_Example.php' in the Applications/Libraries folder.
Libraries can be loaded using the Libraries::get('libraryName') method (FuzeWorks\Libraries::get()).
A module advertises it has certain data, identified by a key. The moment a module gets loaded that listens for that key, it will get send this data.
Using this technique it is possible to load certain predefined data into modules, without loading the actual module. This data is prone to future caching as well.
- Modules can now be loaded using routes by adding a routes[] array to the moduleInfo.php. When it matches, the module gets loaded, and a route() function in the main class gets called. (Fixes#79)
- Composer can now load from a different file
- License headers have been added to all core files (Fixes#66)
- Table model has been renamed to sqltable. Interpret model has been removed
- layoutLoadViewEvent added
- Controllers now extend the \FuzeWorks\ControllerAbstract class
- Controllers are now in the \Application\Controller namespace
- Models are now in the \Application\Model namespace
- Events are now in the \FuzeWorks\Event namespace
- Moved some classes in a different namespace for a better overview
- Events can now properly load function listeners (fixes#81)
- Documentation added to more classes. (Partially fixes#58)
- Added replace() command to DatabaseUtils Abstract Model
- Added more unit tests for router, query and events
Renewed Core
Everything is now static!
Please be reminded that bugs might be present. Do not expect this to work fully 100% yet.
Besided, most Unit tests need to be rebuilt. Please consider doing so before releasing merge.
See merge request !39
Config file ORM for issue #70
Solves #70
Please mind that this will break some serious things when directly reading from the config object.
See merge request !37
Issue #66. Added the ability to add module aliases.
Setting a alias can be done by adding the aliases array to the moduleInfo.php and setting the names in there.
An example can be found in the example module.
See merge request !36
Setting a alias can be done by adding the aliases array to the moduleInfo.php and setting the names in there.
An example can be found in the example module.
The Great rewrite of many modules
Because it was strongly needed.
This merge request will solve the following issues:
#21 , #66 (partially) , #62 , #60 , #58 (partially) , #57
See merge request !35