Fast prototyping for future PHP applications.
A simple PHP application configured with FastRoute, a simple and fast router, and template engines.
Create a prototype of the interface of your future application using your favorite template render engine: Twig or Laravel Blade are actually supported.
When it's done, just move your template files in your favorite framework: Symfony, Laravel, SlimPHP...And start development!
Via Composer
$ composer require cba85/icarus-prototype
Choose the template render engine you will use in your project (the template engine of the framework you have choose for your project).
In config.php
file, specify the template engine you want to use (Twig or Laravel Blade are actually supported):
'engine' => 'twig', // or 'engine' => 'blade'
In src/Controller.php
file, an index
method for /
is created. Just use the render function of the template engine you previously chose:
public function index() {
// Twig
echo $this->view->render('index.html', []);
// Laravel Blade
//echo $this->view->make('index', []);
}
For more information about the rendering of template files, see:
- Cache files are located in
tmp/
folder. You can change this folder inconfig.php
file. - It's possible to disable caching in Twig in
config.php
file:'cache' => false,
- Twig and Blade views example folder are located in
views/example/
.
Create routes in src/routes.php
file:
$r->addRoute('GET', '/', [new App\Controller($view), 'index']);
See FastRoute documentation for more information.
Tests unavailable.