Facula PHP Framework
Facula is a highly extensible experimental non-full-stack framework written in PHP.
It aim to provide a stable interface for the ground floor to make your application can be fit to various environments without changing existing code.
You can download or clone it from Github, or use Composer
Install the Composer, and run:
cd [To/Your/Project/Path] composer require raincious/facula "master"
Install Git and run:
cd [To/Your/Project/Path] git clone https://github.com/raincious/facula
require The framework by adding
index.php or other common procedure file.
See The release section.
To power-on the framework, you need to initialize by the run method.
<?php ... use Facula\Framework; Framework::run();
And then, you will be able to use all the functions provided by the framework:
Framework::core('response')->setContent('Hello World'); Framework::core('response')->send();
For more information of framework usage, please see the examples.
Facula is Not a MVC framework that strictly limit the usage and force you to use MVC pattern.
Which means you can still work with your procedural project and add the framework in.
For managing the ground floor properly, the framework need a environment that can't be interfere. That's means, you can't use function like
echo to output or
ob_* to create buffer. Function that effect globally like
mb_internal_encoding is not recommended to use in data handle process.
Keep in mind, in the presuppose, facula will manage the whole workflow from input to output.
For example, when you want to get data from request, you need to use function core
$pageID = Facula\Framework::core('request')->getGet('page_id'); $content = Facula\Framework::core('request')->getPost('Content'); $cookie = Facula\Framework::core('request')->getCookie('Cookie');
For response, use the
Facula\Framework::core('response')->setCookie('Cookie', 'I remember you'); Facula\Framework::core('response')->setHeader('Your: header'); Facula\Framework::core('response')->setHeader('Another: header'); Facula\Framework::core('response')->setContent('Hi'); Facula\Framework::core('response')->send('html');
However, if you want to keep it your own way and not use the
response function core, you can disable the
response function core by simply extends the
Facula\Framework class, and modify the
protected static $requiredCores array.
If you already have a MVC project, you can still use your old libraries and even frameworks. And only let Facula to help you to handle tasks as you wish.
For example, you can disable all function cores and just let Facula to manage your project file as a autoloader.
Facula core basically is a component loader, which load up components according your configuartion and get them ready to use.
Please see the example project in
examples\BasicStart folder. It showing how to start a fresh MVC project based on Facula Framework.