Skip to content

A pipeline framework use express.js api and reactphp framework for php

License

Notifications You must be signed in to change notification settings

luwake/php-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-express

A pipeline framework use express.js api and reactphp framework for php

example

$app = Express::Application();

$app->get('/', function(Request $req, Response $res){
    return $res->send('Hello World');
});

$app->listen(8080);

example 2 sub router

$app = Express::Application();

$post = Express::Router();

$post->get('/:id', function(Request $req, Response $res){
    return $res->send('Hello Post:' . $req->params['id']);
});

$post->get('/', function(Request $req, Response $res){
    return $res->send('Hello Post');
});

$app->use('/post', $post);

$app->get('/', function(Request $req, Response $res){
    return $res->send('Hello World');
});

$app->listen(8080);

example 3 middleware use

$app = Express::Application();

$app->use(Express::static(__DIR__));

$api = Express::Router('/api');

$api->use(Express::json());

$api->get('/', function(Request $req, Response $res){
    return [
        'code' => 0,
        'msg' => '',
        'data' => [],
    ];
});

$app->use($api);

$app->get('/', function(Request $req, Response $res){
    return $res->send('Hello World');
});

$app->listen(8080);

todo

some method need complete

log

About

A pipeline framework use express.js api and reactphp framework for php

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages