Skip to content

Commit 15515d2

Browse files
authored
Merge pull request #4 from php-api-clients/readme
Fill README with package information
2 parents 83add54 + 6d88b3c commit 15515d2

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing
2+
3+
Pull requests are highly appreciated. Here's a quick guide.
4+
5+
Fork, then clone the repo:
6+
7+
git clone [email protected]:your-username/psr7-oauth1.git
8+
9+
Set up your machine:
10+
11+
composer install
12+
13+
Make sure the tests pass:
14+
15+
make unit
16+
17+
Make your change. Add tests for your change. Make the tests pass:
18+
19+
make unit
20+
21+
Before committing and submitting your pull request make sure it passes PSR2 coding style, unit tests pass and pass on all supported PHP versions:
22+
23+
make contrib
24+
25+
Push to your fork and [submit a pull request][pr].
26+
27+
[pr]: https://help.github.com/articles/creating-a-pull-request/
28+
29+
At this point you're waiting on me. I like to at least comment on pull requests
30+
within a day or two. I may suggest some changes or improvements or alternatives.
31+
32+
Some things that will increase the chance that your pull request is accepted:
33+
34+
* Write tests.
35+
* Follow PSR2 (travis will also check for this).
36+
* Write a [good commit message][commit].
37+
38+
[commit]: http://chris.beams.io/posts/git-commit/

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# API Client PSR-7 Oauth1
1+
# Client-side PSR-7 Oauth1 request signer
22

33
[![Build Status](https://travis-ci.org/php-api-clients/psr7-oauth1.svg?branch=master)](https://travis-ci.org/php-api-clients/psr7-oauth1)
44
[![Latest Stable Version](https://poser.pugx.org/api-clients/psr7-oauth1/v/stable.png)](https://packagist.org/packages/api-clients/psr7-oauth1)
@@ -7,6 +7,44 @@
77
[![License](https://poser.pugx.org/api-clients/psr7-oauth1/license.png)](https://packagist.org/packages/api-clients/psr7-oauth1)
88
[![PHP 7 ready](http://php7ready.timesplinter.ch/php-api-clients/psr7-oauth1/badge.svg)](https://appveyor-ci.org/php-api-clients/psr7-oauth1)
99

10+
# Installation
11+
12+
To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.
13+
14+
```bash
15+
composer require api-clients/psr7-oauth1
16+
```
17+
18+
# Example
19+
20+
```php
21+
<?php
22+
23+
use ApiClients\Tools\Psr7\Oauth1\Definition;
24+
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
25+
use ApiClients\Tools\Psr7\Oauth1\Signature\HmacSha1Signature;
26+
27+
$consumerSecret = new Definition\ConsumerSecret('consumer_secret');
28+
29+
$requestSigner = new RequestSigner(
30+
new Definition\ConsumerKey('consumer_key'),
31+
$consumerSecret,
32+
new HmacSha1Signature( // Optional, but allows for other than HMAC SHA1 signatures
33+
$consumerSecret
34+
)
35+
);
36+
37+
// Pass it a PSR-7 request and it returns a signed PSR7 request you can use in any PSR7 capable HTTP client.
38+
$request = $requestSigner->withAccessToken(
39+
new Definition\AccessToken('token_key'),
40+
new Definition\TokenSecret('token_secret')
41+
)->sign($request);
42+
```
43+
44+
# Contributing
45+
46+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
47+
1048
# License
1149

1250
The MIT License (MIT)

0 commit comments

Comments
 (0)