承接 ashwoodslightfoot/tiny-rest-router 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ashwoodslightfoot/tiny-rest-router

最新稳定版本:0.1.9

Composer 安装命令:

composer require ashwoodslightfoot/tiny-rest-router

包简介

Tiny RESTful router

README 文档

README

tiny-rest-router is a simple library for PHP 5.6+.

Features

  • Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH and OPTIONS)
  • Automatic Parsing
  • Automatic Classes and SubClasses usage

Installation

Composer

tiny-rest-router is PSR-0 compliant and can be installed using composer.
Simply add ashwoodslightfoot/tiny-rest-router to your composer.json file.

{
    "require": {
        "ashwoodslightfoot/tiny-rest-router": "*"
    }
}

or use a console command: composer require "ashwoodslightfoot/tiny-rest-router:*" in your site root folder.

How to configure http server

Add a rest folder to your project root folder. Example: /var/www/mysite/rest. Configure your http server to add route for rest/index.php.

Apache

Make a file .htaccess in your rest folder

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [NC,L,QSA]

Nginx

Add this part to your site configuration file.

location /rest {
    rewrite ^/rest(.*)$ $1&$args break;
    try_files $uri $uri/ /rest/index.php?path=$uri&args;
}

How to use

See a simple example YourSiteFolder/vendor/ashwoodslightfoot/tiny-rest-router/examples/rest/index.php

See a class hierarchy YourSiteFolder/vendor/ashwoodslightfoot/tiny-rest-router/examples/resources/v1. The folder contains classes for RESTful API v1.

统计信息

  • 总下载量: 6.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 11
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-17