ngodinhloc / jennifer
Jennifer Framework
1.1.7
2023-01-03 02:06 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.1
README
Jennifer is a simple PHP framework that implements MVC pattern.
Configuration
composer require ngodinhloc/jennifer
Usage
Single Point Entry
index.php
use Jennifer\Http\Response; use Jennifer\Http\Router; use Jennifer\Sys\System; try { $system = new System([DOC_ROOT . "/config/env.ini"]); $system->setRouter(new Router([DOC_ROOT . "/config/routes.ini"]))->loadView()->renderView(); } catch (Exception $exception) { (new Response())->error($exception->getMessage(), $exception->getCode()); }
api/index.php
use Jennifer\Api\Api; use Jennifer\Http\Response; use Jennifer\Sys\System; use thedaysoflife\Api\ServiceMapper; try { $system = new System([DOC_ROOT . "/config/env.ini"]); $system->setApi(new Api(new ServiceMapper()))->runAPI(); } catch (Exception $exception) { (new Response())->error($exception->getMessage(), $exception->getCode()); }
controllers/index.php
use Jennifer\Http\Response; use Jennifer\Http\Router; use Jennifer\Sys\System; try { $system = new System([DOC_ROOT . "/config/env.ini"]); $system->setRouter(new Router([DOC_ROOT . "/config/routes.ini"]))->loadController()->runController(); } catch (Exception $exception) { (new Response())->error($exception->getMessage(), $exception->getCode()); }
For example of implementation and usage, please take a look at Thedaysoflife project https://github.com/ngodinhloc/thedaysoflife.com which was developed using Jennifer framework