Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/adzialocha/kleiner

Simple PHP Web Framework
https://github.com/adzialocha/kleiner

orm php-framework router

Last synced: 19 days ago
JSON representation

Simple PHP Web Framework

Awesome Lists containing this project

README

        

Kleiner
---

Very simple PHP >=7.1 web framework based on [medoo](https://medoo.in/) and [altorouter](https://altorouter.com/).

## Usage

```php
namespace MyPage;

use Kleiner;

$config = [
'env' => 'production',
'db' => [
'database_type' => 'mysql',
'database_name' => '',
'server' => 'localhost',
'username' => '',
'password' => ''
],
'assetsPath' => '/dist/',
'basePath' => '/',
'baseUrl' => 'https://www.mypage.com'
];

$routes = [
[
'path' => '/admin/[pages|users]?',
'controller' => 'Admin\AdminController',
'action' => 'index',
],
];

$app = new Kleiner(__DIR__ . '/views/', $config);

$app->setupRoutes('MyPage\Controllers\\', $routes);

echo $app->dispatch();
```

```php
isAuthenticated($service, $request, $response);

$data = [
'url' => $this->config['baseUrl'],
'isAuthenticated' => $isAuthenticated,
];

$service->render('admin.php', $data);
}
}
```

## License

MIT