https://github.com/cba85/icarus-prototype
๐ Fast prototyping for future PHP applications
https://github.com/cba85/icarus-prototype
fastroute php prototype twig
Last synced: 12 months ago
JSON representation
๐ Fast prototyping for future PHP applications
- Host: GitHub
- URL: https://github.com/cba85/icarus-prototype
- Owner: cba85
- Created: 2018-04-03T15:15:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-14T22:30:25.000Z (about 8 years ago)
- Last Synced: 2025-03-11T21:44:39.428Z (over 1 year ago)
- Topics: fastroute, php, prototype, twig
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Icarus prototype
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!
## Dependencies
- [FastRoute](https://github.com/nikic/FastRoute)
- [Twig](https://twig.symfony.com)
- [Laravel Blade (jenssegers)](https://github.com/jenssegers/blade)
## Install
Via Composer
``` bash
$ composer require cba85/icarus-prototype
```
## Configuration
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):
```php
'engine' => 'twig', // or 'engine' => 'blade'
```
## Usage
In `src/Controller.php` file, an `index` method for `/` is created. Just use the render function of the template engine you previously chose:
```php
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:
- [Twig documentation](https://twig.symfony.com/doc/2.x/api.html)
- [Laravel Blade documentation](https://github.com/jenssegers/blade)
## Informations
- Cache files are located in `tmp/` folder. You can change this folder in `config.php` file.
- It's possible to disable caching in Twig in `config.php` file:
```php
'cache' => false,
```
- Twig and Blade views example folder are located in `views/example/`.
## Routes
Create routes in `src/routes.php` file:
```php
$r->addRoute('GET', '/', [new App\Controller($view), 'index']);
```
See [FastRoute documentation](https://github.com/nikic/FastRoute) for more information.
## Testing
Tests unavailable.
## Credits
- [Clรฉment Barbaza](https://github.com/cba85)