The lightweight, flexible PHP framework for rapid and robust development.
- Minimal, expressive routing
- Simple, chainable database queries
- Powerful session management
- PSR-4 autoloading support
- Easy integration with Apache or Nginx
- Composer-ready
composer create-project sadiq-bd/alkane-phpuse Core\Router;
// Basic route
Router::get('/', function() {
return 'Hello World';
});
// Route with parameter
Router::get('/user/{id}', function($param) {
return 'User ID - ' . $param['id'];
});
// Route with controller
Router::get('/home', App\Controller\HomeController::class, 'method');$db = Core\Database::getInstance();
// or: $db = new Alkane\Database(?$custom_connection_name);
$sql = new Core\SqlQuery($db);
$sql->select(['ID', 'name', 'email'])
->from('table')
->where('ID = :id', ['id' => 20]);
$result = $sql->exec();
print_r($result->fetch(Core\SqlQuery::FETCH_ASSOC));Core\SessionController::set('mail.smtp.host', 'smtp.gmail.com');
Core\SessionController::set('mail.smtp.user', 'user@gmail.com');
Core\SessionController::set('mail.smtp.password', 'your_password');
// Retrieve session data
print_r(Core\SessionController::get('mail.smtp'));
/* Output:
Array (
[host] => smtp.gmail.com
[user] => user@gmail.com
[password] => your_password
)
*/Add the following rewrite rules to your .htaccess:
RewriteEngine On
RewriteRule ^(.*)$ index.php [L,QSA]
ErrorDocument 400 /index.php
ErrorDocument 401 /index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
ErrorDocument 500 /index.php
ErrorDocument 502 /index.php
ErrorDocument 503 /index.php
Paste this in your server block:
location / {
rewrite ^(.*)$ /index.php?$1 last;
}
Official documentation is coming soon. For now, see the example code above or explore the source!
Pull requests and issues are welcome! For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.