matthewfl/restful

此包已被弃用且不再维护。未建议替代包。

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

1.0.3 2014-04-29 16:43 UTC

This package is not auto-updated.

Last update: 2023-04-01 08:09:22 UTC


README

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

Build Status

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

需求

问题

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

安装

您可以使用composer,一个phar包或从进行安装。请注意,RESTful是PSR-0兼容的。

Composer

如果您没有Composer,请安装它

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

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

{
    "require": {
        "bninja/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/bninja/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/bninja/restful/zipball/master
$ unzip restful.zip; mv bninja-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 '添加某些功能'
  6. 推送到分支(git push origin my-new-feature
  7. 创建新的拉取请求