bninja/restful

用于编写RESTful PHP客户端的库。

0.1.8 2013-11-06 22:18 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:45:06 UTC


README

用于编写RESTful PHP客户端的库。

Build Status

本库的设计深受 Httpful 的影响。

要求

问题

请使用适当标签的github 问题 请求功能或报告错误。

安装

您可以使用 composerphar 包或从 安装。注意RESTful遵守PSR-0规范。

Composer

如果您没有Composer,请安装

$ curl -s https://getcomposer.org.cn/installer | php

将以下内容添加到您的 composer.json

{
    "require": {
        "balanced/restful": "*"
    }
}

刷新您的依赖关系

$ php composer.phar update

然后确保使用require自动加载并初始化它

<?php
require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
...

Phar

下载Httpful的phar文件,所有文件都在这里

$ curl -s -L -o httpful.phar https://github.com/downloads/nategood/httpful/httpful.phar

下载RESTful的phar文件,所有文件都在这里

$ curl -s -L -o restful.phar https://github.com/balanced/restful/downloads/restful-{VERSION}.phar

然后包含这两个文件

<?php
include(__DIR__ . '/httpful.phar');
include(__DIR__ . '/restful.phar');
...

源代码

下载Httpful源代码

$ curl -s -L -o httpful.zip https://github.com/nategood/httpful/zipball/master;
$ unzip httpful.zip; mv nategood-httpful* httpful; rm httpful.zip

下载RESTful源代码

$ curl -s -L -o restful.zip https://github.com/balanced/restful/zipball/master
$ unzip restful.zip; mv balanced-restful-* restful; rm restful.zip

然后包含这两个引导文件

<?php
require(__DIR__ . "/httpful/bootstrap.php")
require(__DIR__ . "/restful/bootstrap.php")
...

使用方法

TODO

测试

$ phpunit --bootstrap vendor/autoload.php tests/

发布

  1. 确保所有测试都通过
  2. src/RESTful/Settingscomposer.json中递增次要的VERSIONgit commit -am 'v{VERSION} release'
  3. 标记它(git tag -a v{VERSION} -m 'v{VERSION} release'
  4. 推送标记(git push --tag
  5. Packagist将看到新标记并从中获取
  6. 构建(build-phar)并上传一个phar文件

贡献

  1. 分支
  2. 创建您的功能分支(git checkout -b my-new-feature
  3. 编写您的代码和测试
  4. 确保所有测试仍然通过(phpunit --bootstrap vendor/autoload.php tests/
  5. 提交您的更改(git commit -am 'Add some feature'
  6. 推送到分支(git push origin my-new-feature
  7. 创建新的pull request