restful/wrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

restful/wrapper

Composer 安装命令:

composer require restful/wrapper

包简介

A php wrapper for RESTful apis

README 文档

README

Build Status

Scrutinizer Code Quality

Code Coverage

A simple php RESTful api wrapper.

Code example

  $restful = new RESTful('https://<yourcompany>.com/<path>/<to>/<resource>', '<token>');
  $restful->post($path, $data);

Default Content-Type

The default Content-Type is application/json

To change the default Content-Type

  $restful->setContentType(<newContentType>);

Default URL Path Configuration and Authentication

The default URL Path is <baseURI>/<paht_to_data>/<token>/

If you need to add a special configuration to the URL path

  $restful->setPathConfiguration(<newPathConfiguration>);

Examples

Firebase needs a .json?auth= format.

  $restful = new RESTful('https://<yourcompany>.com/<path>/<to>/<resource>', '<token>');
  $restful->setPathConfiguration('.json?auth=');
  $restful->post($path, $data);

Header Authentication

To set the authentication in the header request

  $restful->setHeaderProperty('<name_of_property>');

The full header property will be

  '<name_of_property>: <token>'

List of Library Methods

delete($path) 
get($path) 
getHeaderLocation() 
getHeaderResponseCode() 
getResponseBody() 
patch($path, $data) 
post($path, $data) 
put($path, $data) 
setBaseURI($baseURI) 
setContentType($contentType) 
setHeaderProperty($headerProperty) 
setPathConfiguration($pathConfiguration) 
setTimeOut($seconds) 
setToken($token)

Unit Tests

All the unit tests are found in the "/tests" directory.

The RESTful tests can be executed by running the following command:

All Tests

$ phpunit 

Test Groups

$ phpunit --group <groupName> 

Single Test

$ phpunit tests/unit/<file_name.php>

I started with the firebase-php library (https://github.com/ktamas77/firebase-php). Tamas' code is simply amazing! I helped him write the tests and the test stub. I reached out to him to fork and abstract the code but I never received a response.

-- Firebase PHP Class & Client Library --

https://github.com/ktamas77/firebase-php @author Tamas Kalman ktamas77@gmail.com

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固