https://github.com/ledccn/micro-mark
基于FastRoute和workerman的极简API框架
https://github.com/ledccn/micro-mark
Last synced: 2 months ago
JSON representation
基于FastRoute和workerman的极简API框架
- Host: GitHub
- URL: https://github.com/ledccn/micro-mark
- Owner: ledccn
- Created: 2023-10-09T02:08:00.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-09T02:09:37.000Z (over 2 years ago)
- Last Synced: 2025-01-01T18:41:44.523Z (over 1 year ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mark is a high performance API micro framework based on [FastRoute](https://github.com/nikic/FastRoute) and [workerman](https://github.com/walkor/workerman) helps you quickly write APIs with php. It is so simple that the [core codes](https://github.com/passwalls/mark/blob/master/src/App.php) is only about 200 lines.
# Install
It's recommended that you use Composer to install Mark.
`composer require ledc/mark`
# Usage
start.php
```php
count = 4; // process count
$api->any('/', function ($requst) {
return 'Hello world';
});
$api->get('/hello/{name}', function ($requst, $name) {
return "Hello $name";
});
$api->post('/user/create', function ($requst) {
return json_encode(['code'=>0 ,'message' => 'ok']);
});
$api->start();
```
Run command `php start.php start -d`
Going to http://127.0.0.1:3000/hello/world will now display "Hello world".
# Benchmark
https://github.com/the-benchmarker/web-frameworks#results
# Available commands
```
php start.php restart -d
php start.php stop
php start.php status
php start.php connections
```
# License
The Mark Framework is licensed under the MIT license. See License File for more information.