GithubHelp home page GithubHelp logo

ycf's Introduction

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
  3. chmod -R 777 src/runtime/
  4. 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
  • 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

Community

mail: [email protected] qq群: 141059677

##License The ycf framework is open-sourced software licensed under the MIT license

ycf's People

Contributors

kcloze avatar

Stargazers

Chen,Yongze avatar  avatar  avatar

Watchers

James Cloos avatar  avatar Chen,Yongze avatar  avatar

Forkers

guoyu07 uiboom

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.