An open API service indexing awesome lists of open source software.

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!

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){

}
}
}
```