sadick/resty

一个简单的 PHP 路由器

v0.12.0 2018-12-11 13:47 UTC

README

CircleCI

Resty

一个快速、最小化且无依赖性的 PHP 路由器,允许你直接编写 RESTful API

安装

使用 Composer 安装 Resty

composer require sadick/resty

用法

<?php

require 'vendor/autoload.php'
use Resty\Router;

$app = new Router();
$app->get('/users', function ($req, $res) {
  $res->send("hello world");
});

$app->serve();

你可以使用内置的 PHP 服务器测试你的请求是否被正确服务

php -S localhost:4000

访问 https://:4000/users 将显示 hello world