| Tiny is a simple framework. Developed with the intention of simplifying the development of small projects. |
Make a file .php in PROJECT >> ROUTES. Inside this file, insert code route. Only GET/POST available.
//Default route for news
$this->get('news', function($params){
echo "All news here";
});
//Specific route for news
$this->get('news/{id}', function($params){
echo "News: {$param['id']}";
});Make a file .php in PROJECT >> TEMPLATES with your front-end. In PROJECT >> ROUTES make a new file .php. After, define a new route and call the method render of template class.
$this->get('news', function($params){
$tpl = $this->core->loadModule('template');
$db = $this->core->loadModule('database');
$sql = $db->query('SELECT * FROM news');
$array = $sql->fetchAll();
echo $tpl->render('news.twig', ['news' => $array]);
});In your project folder, edit the config.php and your datas in $db array.
$config = array(
'db' => array(
'host' => 'localhost',
'user' => 'root',
'pass' => '',
'dbname' => 'db_name'
)
);Want to contribute? Great!
To fix a bug or enhance an existing module, follow these steps:
- Fork the repo
- Create a new branch (
git checkout -b improve-feature) - Make the appropriate changes in the files
- Add changes to reflect the changes made
- Commit your changes (
git commit -am 'Improve feature') - Push to the branch (
git push origin improve-feature) - Create a Pull Request
If you'd like to request a new function, feel free to do so by opening an issue here. Please include sample queries and their corresponding results.
- Add in packagist for download by composer.
Add template engine. (Twig)- add Monolog for logs.
- Group routes
Devs: Gabriel Moreira - https://github.com/Venzke