https://github.com/kcloze/ycf
基于swoole的微型框架,专为api业务场景设计
https://github.com/kcloze/ycf
api cli swoole
Last synced: 6 months ago
JSON representation
基于swoole的微型框架,专为api业务场景设计
- Host: GitHub
- URL: https://github.com/kcloze/ycf
- Owner: kcloze
- Created: 2016-05-04T13:29:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-27T09:13:03.000Z (about 10 years ago)
- Last Synced: 2024-04-22T03:47:24.870Z (about 2 years ago)
- Topics: api, cli, swoole
- Language: PHP
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ycf framework
* a very simple,micro PHP framework
* it can be run in Cli,PHP-FPM,Swoole
* composer install and name space auto load
* a solution for micro-services and blazing fast APIs
## Requirements
* PHP 5.3+
## Installation
1. git clone https://github.com/kcloze/ycf.git your-app
2. cd your-app and run: composer install
2. chmod -R 777 src/runtime/
3. edit src/config/settings.ini.php for mysql config or redis,add test table(https://github.com/kcloze/ycf/blob/master/pdo_test.sql)
## How to run
###php-fpm
run in php-fpm: Open your browser and enter http://youhost/index.php?ycf=hello&act=hello
if set nginx as follow,url can be simple: http://youhost/hello/hello
```
location / {
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
```
###cli
####run in cli:
* php index.php ycf=hello act=hello
###swoole
run with swoole:
* php env in you path
* chmod u+x server.sh
* ./server.sh
## Documentation
* in src/service/ ,you can add your business code here
* Naming Conventions:
* ---service class name :YcfYourname.php
* ---method name : public static function actionYourname()
* [DB Class Use](doc/db.md)
* if you need redis,shoud install phpredis extention(https://github.com/phpredis/phpredis)
##How to use Task
```
public function actionTask()
{
// send a task to task worker.
$param = array(
'action' => 'test',
'time' => time(),
);
//var_dump(HttpServer::getInstance()->http);
//$this->http->task(json_encode($param));
for ($i = 0; $i < 1; $i++) {
$taskId = YcfCore::$_http_server->task(json_encode($param));
}
echo $taskId . " hello ycf" . time();
}
```
## Benchmarks
[benchmarks](doc/benchmarks.md)
## Community
mail: pei.greet@gmail.com
qq群: 141059677
##License
The ycf framework is open-sourced software licensed under the MIT license