https://github.com/abbychau/hackish
A 14-line full functional php framework with a safe and protected template system, a database wrapper with error handling, and a full functional router!
https://github.com/abbychau/hackish
hackathon minimalist php php-router phpframework router
Last synced: about 2 months ago
JSON representation
A 14-line full functional php framework with a safe and protected template system, a database wrapper with error handling, and a full functional router!
- Host: GitHub
- URL: https://github.com/abbychau/hackish
- Owner: abbychau
- Created: 2017-07-24T14:28:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-10T06:06:31.000Z (over 7 years ago)
- Last Synced: 2025-02-14T03:15:30.405Z (3 months ago)
- Topics: hackathon, minimalist, php, php-router, phpframework, router
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hackish
This is the smallest (14 lines) full functional PHP framework with following features:
## Safe and protected template system
```html
{name}
```
```php
render('name',['name'=>'Abby']);
```## Database wrapper with error handling
```php
$conn = @mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD); //declare once
$a = dbAr("SELECT * FROM test"); //output an assoc array
```## Full functional router
```php
$routes['ALL']['/^\/blog\/(\w+)\/(\d+)\/?$/'] = function($category, $id){
print "category={$category}, id={$id}";
};
$routes['GET']['/^\/blog\/(\w+)\/(\d+)\/?$/'] = function($category, $id){
print "category={$category}, id={$id}";
};
$routes['ALL']['/watch\?v=(\w+)/'] = function($id){
include('view.php');
};
```## Migration (to-do)
``` php
//todo
function migrate($csv){
foreach(explode(PHP_EOL, file_get_contents($csv)) as $line){
if($x++ == 0){dbAr("CREATE TABLE $csv"
foreach(explode(",", file_get_contents($csv)) as $line){
}
}
}
```