masterforweb / kuri
Kuri is a PHP autorouting without regular. Quickly write simple yet powerful web applications and APIs
1.0.2
2022-10-11 12:58 UTC
Requires
- php: >=5.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpstan/phpstan: ^1.6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-30 01:40:59 UTC
README
Kuri is minimalist web framework for PHP. Minimum code - maximum speed. Quick start your web application or API.
Installation
It's recommended that you use Composer to install Kuri.
composer require masterforweb/kuri
Autoroutes:
https://{your domain}/{your function}/param1
or
https://{your domain}/{your class}/{funtion}/param1/param2
or
command line: php {application path}/index.php {your function} param
Hello World
require 'vendor/autoload.php'; kuri(); function index() { echo 'Hello World! Is index page'; }
Recommended practice: prefix _kuri
require 'vendor/autoload.php'; _kuri(); function index_kuri() { echo 'Hello World! Is index page'; } function id_kuri(int $id){ echo "result $id"; }
Class example
_kuri(); class news_kuri { function id($id){ echo 'ID ='.$id; } }
GET, POST
_kuri(); class news_kuri { function get($id){ echo 'ID ='.$id; } function post($title, $text) { $sql = "INSERT INTO `news` (`title`, `name`) VALUES($title, $text);"; } }
return array => 200 OK Content-Type: application/json
require 'vendor/autoload.php'; _kuri(); function about_kuri(){ return [ 'author' => 'masterforweb', 'email' => 'masterforweb@hotmail.com', 'name' => 'kuri' ]; }
curl -I http://kuri.dv/about HTTP/1.1 200 OK Content-Type: application/json; utf-8 curl http://kuri.dv/about {"author":"masterforweb","email":"masterforweb@hotmail.com","name":"kuri"}
support: masterforweb@hotmail.com