- 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
- PHP 5.3+
- git clone https://github.com/kcloze/ycf.git your-app
- cd your-app and run: composer install
- chmod -R 777 src/runtime/
- edit src/config/settings.ini.php for mysql config or redis,add test table(https://github.com/kcloze/ycf/blob/master/pdo_test.sql)
###php-fpm
run in php-fpm: Open your browser and enter https://youhost/index.php?ycf=hello&act=hello
if set nginx as follow,url can be simple: https://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
- 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
- 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();
}
mail: [email protected] qq群: 141059677
##License The ycf framework is open-sourced software licensed under the MIT license