Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 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>
14
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.
15
 
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 [dx@sendgrid.com](mailto:dx@sendgrid.com).  SendGrid will then confirm you are ready to begin making contributions.
26
 
27
There are a few ways to contribute, which we'll enumerate below:
28
 
29
<a name="feature_request"></a>
30
## Feature Request
31
 
32
If you'd like to make a feature request, please read this section.
33
 
34
The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
35
 
36
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
37
- Please be respectful and considerate of others when commenting on issues
38
 
39
<a name="submit_a_bug_report"></a>
40
## Submit a Bug Report
41
 
42
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
43
 
44
A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
45
 
46
Before you decide to create a new issue, please try the following:
47
 
48
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
49
2. Update to the latest version of this code and check if issue has already been fixed
50
3. Copy and fill in the Bug Report Template we have provided below
51
 
52
### Please use our Bug Report Template
53
 
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.
55
 
56
<a name="improvements_to_the_codebase"></a>
57
## Improvements to the Codebase
58
 
59
We welcome direct contributions to the php-http-client code base. Thank you!
60
 
61
### Development Environment ###
62
 
63
#### Install and Run Locally ####
64
 
65
##### Prerequisites #####
66
 
67
- PHP 5.6 or 7.0
68
- [Composer](https://getcomposer.org/)
69
 
70
##### Initial setup: #####
71
 
72
```bash
73
git clone https://github.com/sendgrid/php-http-client.git
74
cd php-http-client
75
```
76
 
77
## Environment Variables
78
 
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).
82
 
83
```bash
84
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
85
echo "sendgrid.env" >> .gitignore
86
source ./sendgrid.env
87
```
88
 
89
##### Execute: #####
90
 
91
See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples
92
<a name="understanding_the_codebase"></a>
93
## Understanding the Code Base
94
 
95
**/examples**
96
 
97
Working examples that demonstrate usage.
98
 
99
**/test/unit**
100
 
101
Unit tests.
102
 
103
**/lib/SendGrid/Client.php**
104
 
105
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.
106
 
107
This allows for the following mapping from a URL to a method chain:
108
 
109
`/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).
110
 
111
**/lib/SendGrid/Config.php**
112
 
113
Loads the environment variables.
114
 
115
<a name="testing"></a>
116
## Testing
117
 
118
All PRs require passing tests before the PR will be reviewed.
119
 
120
All test files are in the [`/test/unit`](https://github.com/sendgrid/php-http-client/tree/master/test/unit) directory.
121
 
122
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.
123
 
124
```bash
125
phpunit --bootstrap test/unit/bootstrap.php --filter test* test/unit
126
```
127
 
128
<a name="style_guidelines_and_naming_conventions"></a>
129
## Style Guidelines & Naming Conventions
130
 
131
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.
132
 
133
- [pear coding standards](https://pear.php.net/manual/en/standards.php)
134
 
135
Please run your code through:
136
 
137
- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
138
 
139
## Creating a Pull Request<a name="creating_a_pull_request"></a>
140
 
141
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
142
   and configure the remotes:
143
 
144
   ```bash
145
   # Clone your fork of the repo into the current directory
146
   git clone https://github.com/sendgrid/php-http-client
147
   # Navigate to the newly cloned directory
148
   cd sendgrid-python
149
   # Assign the original repo to a remote called "upstream"
150
   git remote add upstream https://github.com/sendgrid/php-http-client
151
   ```
152
 
153
2. If you cloned a while ago, get the latest changes from upstream:
154
 
155
   ```bash
156
   git checkout <dev-branch>
157
   git pull upstream <dev-branch>
158
   ```
159
 
160
3. Create a new topic branch (off the main project development branch) to
161
   contain your feature, change, or fix:
162
 
163
   ```bash
164
   git checkout -b <topic-branch-name>
165
   ```
166
 
167
4. Commit your changes in logical chunks. Please adhere to these [git commit
168
   message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
169
   or your code is unlikely be merged into the main project. Use Git's
170
   [interactive rebase](https://help.github.com/articles/interactive-rebase)
171
   feature to tidy up your commits before making them public.
172
 
173
4a. Create tests.
174
 
175
4b. Create or update the example code that demonstrates the functionality of this change to the code.
176
 
177
5. Locally merge (or rebase) the upstream development branch into your topic branch:
178
 
179
   ```bash
180
   git pull [--rebase] upstream master
181
   ```
182
 
183
6. Push your topic branch up to your fork:
184
 
185
   ```bash
186
   git push origin <topic-branch-name>
187
   ```
188
 
189
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
190
    with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
191
 
192
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.