Skip to content

Commit f9eb9b2

Browse files
Updated to conform to SendGrid's new Open Source policies
1 parent 36bb25d commit f9eb9b2

File tree

4 files changed

+102
-151
lines changed

4 files changed

+102
-151
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
3+
34
This project adheres to [Semantic Versioning](http://semver.org/).
45

56
## [2.0.2] - 2016-02-29

CONTRIBUTING.md

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
Hello! Thank you for choosing to help contribute to the php-http-client. There are many ways you can contribute and help is always welcome.
2-
1+
Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
2+
3+
- [CLAs and CCLAs](#cla)
4+
- [Roadmap & Milestones](#roadmap)
5+
- [Feature Request](#feature_request)
6+
- [Submit a Bug Report](#submit_a_bug_report)
7+
- [Improvements to the Codebase](#improvements_to_the_codebase)
8+
- [Understanding the Code Base](#understanding_the_codebase)
9+
- [Testing](#testing)
10+
- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11+
- [Creating a Pull Request](#creating_a_pull_request)
12+
13+
<a name="roadmap"></a>
314
We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
415

5-
* [Feature Request](#feature_request)
6-
* [Submit a Bug Report](#submit_a_bug_report)
7-
* [Improvements to the Codebase](#improvements_to_the_codebase)
8-
* [Understanding the Code Base](#understanding_the_codebase)
9-
* [Testing](#testing)
10-
* [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11-
* [Creating a Pull Request](#creating_a_pull_request)
16+
<a name="cla"></a>
17+
## CLAs and CCLAs
18+
19+
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) or a SendGrid Company Contributor Licensing Agreement (CCLA) be filled out by every contributor to a SendGrid open source project.
20+
21+
Our goal with the CLA and CCLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA and CCLA encourage broad participation by our open source community and help us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
22+
23+
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA (or CCLA). Copies of the CLA and CCLA are available [here](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view).
24+
25+
You may submit your completed [CLA or CCLA](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view) to SendGrid at [[email protected]](mailto:[email protected]). SendGrid will then confirm you are ready to begin making contributions.
1226

1327
There are a few ways to contribute, which we'll enumerate below:
1428

@@ -37,29 +51,7 @@ Before you decide to create a new issue, please try the following:
3751

3852
### Please use our Bug Report Template
3953

40-
In order to make the process easier, we've included a sample bug report template (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
41-
42-
```
43-
Short and descriptive example bug report title
44-
45-
#### Issue Summary
46-
47-
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
48-
49-
50-
#### Steps to Reproduce
51-
52-
1. This is the first step
53-
2. This is the second step
54-
3. Further steps, etc.
55-
56-
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
57-
58-
#### Technical details:
59-
60-
* php-http-client Version: master (latest commit: 2cb34372ef0f31352f7c90015a45e1200cb849da)
61-
* PHP Version: 5.6
62-
```
54+
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
6355

6456
<a name="improvements_to_the_codebase"></a>
6557
## Improvements to the Codebase
@@ -68,43 +60,55 @@ We welcome direct contributions to the php-http-client code base. Thank you!
6860

6961
### Development Environment ###
7062

71-
#### Install and run locally ####
63+
#### Install and Run Locally ####
7264

7365
##### Prerequisites #####
7466

75-
* PHP 5.2 through 5.6
76-
* [Composer](https://getcomposer.org/)
67+
- PHP 5.2 through 5.6
68+
- [Composer](https://getcomposer.org/)
7769

7870
##### Initial setup: #####
7971

80-
```
72+
```bash
8173
git clone https://github.com/sendgrid/php-http-client.git
8274
cd php-http-client
83-
cp .env_sample .env
8475
```
8576

86-
Update your settings in `.env`
77+
## Environment Variables
8778

88-
##### Execute: #####
79+
First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client).
80+
81+
Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
8982

90-
See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples) to get started quickly.
83+
```bash
84+
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
85+
echo "sendgrid.env" >> .gitignore
86+
source ./sendgrid.env
87+
```
9188

89+
##### Execute: #####
90+
91+
See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples
9292
<a name="understanding_the_codebase"></a>
9393
## Understanding the Code Base
9494

9595
**/examples**
9696

9797
Working examples that demonstrate usage.
9898

99-
**client.php**
99+
**/test/unit**
100+
101+
Unit tests.
102+
103+
**/lib/SendGrid/Client.php**
100104

101105
An HTTP client with a fluent interface using method chaining and reflection. By returning self on [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) and [_()](https://github.com/sendgrid/php-http-client/blob/master/lib/client.pph#L198), we can dynamically build the URL using method chaining and [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) allows us to dynamically receive the method calls to achieve reflection.
102106

103107
This allows for the following mapping from a URL to a method chain:
104108

105109
`/api_client/{api_key_id}/version` maps to `client->api_client().->_($api_key_id)->version-><method>()` where <method> is a [HTTP verb](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L94).
106110

107-
**config.php**
111+
**/lib/SendGrid/Config.php**
108112

109113
Loads the environment variables.
110114

@@ -113,26 +117,24 @@ Loads the environment variables.
113117

114118
All PRs require passing tests before the PR will be reviewed.
115119

116-
All test files are in the `[test/unit](https://github.com/sendgrid/php-http-client/tree/master/test/unit)` directory.
120+
All test files are in the [`/test/unit`](https://github.com/sendgrid/php-http-client/tree/master/test/unit) directory.
117121

118122
For the purposes of contributing to this repo, please update the [`ClientTest.php`](https://github.com/sendgrid/php-http-client/blob/master/test/unit/ClientTest.php) file with unit tests as you modify the code.
119123

120-
`phpunit --bootstrap test/unit/bootstrap.php --filter test* test/unit`
124+
```bash
125+
phpunit --bootstrap test/unit/bootstrap.php --filter test* test/unit
126+
```
121127

122128
<a name="style_guidelines_and_naming_conventions"></a>
123129
## Style Guidelines & Naming Conventions
124130

125131
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
126132

127-
* [pear coding standards](https://pear.php.net/manual/en/standards.php)
128-
129-
Please run your code through [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
133+
- [pear coding standards](https://pear.php.net/manual/en/standards.php)
130134

131-
### Directory Structure
135+
Please run your code through:
132136

133-
* `examples`, for example calls
134-
* `test\unit`, for all tests
135-
* 'lib`, for source code
137+
- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
136138

137139
## Creating a Pull Request<a name="creating_a_pull_request"></a>
138140

@@ -143,7 +145,7 @@ Please run your code through [PHP Code Sniffer](https://github.com/squizlabs/PHP
143145
# Clone your fork of the repo into the current directory
144146
git clone https://github.com/sendgrid/php-http-client
145147
# Navigate to the newly cloned directory
146-
cd php-http-client
148+
cd sendgrid-python
147149
# Assign the original repo to a remote called "upstream"
148150
git remote add upstream https://github.com/sendgrid/php-http-client
149151
```
@@ -187,4 +189,4 @@ Please run your code through [PHP Code Sniffer](https://github.com/squizlabs/PHP
187189
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
188190
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
189191

190-
If you have any additional questions, please feel free to [email](mailto:[email protected]) us or create an issue in this repo.
192+
If you have any additional questions, please feel free to [email](mailto:[email protected]) us or create an issue in this repo.

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 SendGrid
3+
Copyright (c) 2016 SendGrid, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 45 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
**Quickly and easily access any REST or REST-like API.**
44

5+
# Announcements
6+
7+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md).
8+
9+
# Installation
10+
11+
Add php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
12+
13+
```json
14+
{
15+
"require": {
16+
"sendgrid/php-http-client": "2.*"
17+
}
18+
}
19+
```
20+
21+
Then at the top of your PHP script require the autoloader:
22+
23+
```php
24+
require __DIR__ . '/vendor/autoload.php';
25+
```
26+
27+
Then from the command line:
28+
29+
```bash
30+
composer install
31+
```
32+
33+
# Quick Start
34+
535
Here is a quick example:
636

737
`GET /your/api/{param}/call`
@@ -33,116 +63,34 @@ print $response->responseHeaders();
3363
print $response->responseBody();
3464
```
3565

36-
# Installation
37-
38-
Add php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
39-
40-
```json
41-
{
42-
"require": {
43-
"sendgrid/php-http-client": "2.*"
44-
}
45-
}
46-
```
47-
48-
Then at the top of your PHP script require the autoloader:
49-
50-
```php
51-
require __DIR__ . '/vendor/autoload.php';
52-
```
53-
54-
Then from the command line:
55-
56-
```bash
57-
composer install
58-
```
59-
60-
## Usage ##
61-
62-
Following is an example using SendGrid. You can get your free account [here](https://sendgrid.com/free?source=php-http-client).
66+
# Usage
6367

64-
First, update your .env with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) and HOST. For this example HOST=https://api.sendgrid.com.
68+
- [Example Code](https://github.com/sendgrid/php-http-client/tree/master/examples)
6569

66-
Following is an abridged example, here is the [full working code](https://github.com/sendgrid/php-http-client/tree/master/examples).
70+
## Roadmap
6771

68-
```php
69-
<?php
70-
require __DIR__ . '/vendor/autoload.php';
71-
$config = new SendGrid\Config(getcwd(), '.env');
72-
$api_key = getenv('SENDGRID_API_KEY');
73-
$headers = array(
74-
'Content-Type: application/json',
75-
'Authorization: Bearer '.$api_key
76-
);
77-
$client = new SendGrid\Client('https://api.sendgrid.com', $headers, '/v3', null);
78-
79-
// GET Collection
80-
$query_params = array('limit' => 100, 'offset' => 0);
81-
$request_headers = array('X-Mock: 200');
82-
$response = $client->api_keys()->get(null, $query_params, $request_headers);
83-
84-
// POST
85-
$request_body = array(
86-
'name' => 'My PHP API Key',
87-
'scopes' => array(
88-
'mail.send',
89-
'alerts.create',
90-
'alerts.read'
91-
)
92-
);
93-
$response = $client->api_keys()->post($request_body);
94-
$response_body = json_decode($response->responseBody());
95-
$api_key_id = $response_body->api_key_id;
96-
97-
// GET Single
98-
$response = $client->version('/v3')->api_keys()->_($api_key_id)->get();
99-
100-
// PATCH
101-
$request_body = array(
102-
'name' => 'A New Hope'
103-
);
104-
$response = $client->api_keys()->_($api_key_id)->patch($request_body);
105-
106-
// PUT
107-
$request_body = array(
108-
'name' => 'A New Hope',
109-
'scopes' => array(
110-
'user.profile.read',
111-
'user.profile.update'
112-
)
113-
);
114-
$response = $client->api_keys()->_($api_key_id)->put($request_body);
115-
116-
// DELETE
117-
$response = $client->api_keys()->_($api_key_id)->delete();
118-
?>
119-
```
72+
If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback.
12073

121-
# Announcements
74+
## How to Contribute
12275

123-
[2016.03.28] - We hit version 1!
76+
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)) guide for details.
12477

125-
# Roadmap
78+
Quick links:
12679

127-
[Milestones](https://github.com/sendgrid/php-http-client/milestones)
128-
129-
# How to Contribute
130-
131-
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md) guide for details.
132-
133-
* [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature_request)
134-
* [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit_a_bug_report)
135-
* [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
80+
- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)#feature_request)
81+
- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)#submit_a_bug_report)
82+
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)#cla)
83+
- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)#improvements_to_the_codebase)
13684

13785
# Thanks
13886

13987
We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient).
14088

14189
# About
14290

143-
![SendGrid Logo]
144-
(https://assets3.sendgrid.com/mkt/assets/logos_brands/small/sglogo_2015_blue-9c87423c2ff2ff393ebce1ab3bd018a4.png)
145-
14691
php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:[email protected]).
14792

148-
php-http-client is maintained and funded by SendGrid, Inc. The names and logos for python-http-client are trademarks of SendGrid, Inc.
93+
php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc.
94+
95+
![SendGrid Logo]
96+
(https://assets3.sendgrid.com/mkt/assets/logos_brands/small/sglogo_2015_blue-9c87423c2ff2ff393ebce1ab3bd018a4.png)

0 commit comments

Comments
 (0)