https://github.com/pluveto/cirno
Cirno is a light-weight php RESTful api framework
https://github.com/pluveto/cirno
framwork php restful-api
Last synced: about 1 year ago
JSON representation
Cirno is a light-weight php RESTful api framework
- Host: GitHub
- URL: https://github.com/pluveto/cirno
- Owner: pluveto
- Created: 2020-01-22T10:39:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-22T14:05:23.000Z (over 6 years ago)
- Last Synced: 2025-02-09T08:18:48.062Z (over 1 year ago)
- Topics: framwork, php, restful-api
- Language: PHP
- Size: 28.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# Cirno
Cirno-php is a light-weight php api framework for rapid development, based on Flight and Medoo, with apiDoc support.
## Features
Cirno-php helps create api with many **AUTOMATICAL** operations, which saves your massive time.
1. Auto generate **http methods, routes** into files.
2. Auto **parameters** basic filte.
3. Auto **user permissions** filte
Let's take an example:
Create a file `src/Api/Calculator.php`
```php
request()->query->num;
\App::$api->json([
"result" => $num * $num
]);
}
}
```
And execute:
```shell
$ php generator.php run
```
You can see some files generated:
```php
//file: src/common/route.php
[
'param' => [
'num' => [
'type' => 'integereger',
'min' => 0,
'max' => 200,
'required' => true,
],
],
],
];
```
```php
//file: src/common/permission.php
'none',
];
```
And then we go to `http://127.0.0.1:8080/calc/sqrt?num=10`
We got:
```json
{
"result": 100
}
```
What if `http://127.0.0.1:8080/calc/sqrt?num=1000`?
```json
{
"message": "Parameter `num` is expected to be less than 200. "
}
```
And what if `http://127.0.0.1:8080/calc/sqrt?ss=1000`?
```json
{
"message": "Mising required parameter."
}
```
And `http://127.0.0.1:8080/calc/sqrt?num=`?
```json
{
"message": "Parameter `num` is given but it has empty value."
}
```
As you can see, what you need to do is just write API code. API comments will be parsed.