Skip to content

Commit c4c10da

Browse files
author
Martin Brecht-Precht
committed
Basic project setup
1 parent 5a2e84f commit c4c10da

File tree

7 files changed

+268
-1
lines changed

7 files changed

+268
-1
lines changed

.codeclimate.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
engines:
2+
duplication:
3+
enabled: true
4+
config:
5+
languages:
6+
- ruby
7+
- javascript
8+
- python
9+
- php
10+
fixme:
11+
enabled: true
12+
phpmd:
13+
enabled: true
14+
checks:
15+
CleanCode/ElseExpression:
16+
enabled: false
17+
ratings:
18+
paths:
19+
- "**.inc"
20+
- "**.js"
21+
- "**.jsx"
22+
- "**.module"
23+
- "**.php"
24+
- "**.py"
25+
- "**.rb"
26+
exclude_paths:
27+
- test/
28+
- vendor/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
composer.lock

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
language: php
2+
3+
branches:
4+
only:
5+
- master
6+
7+
php:
8+
- '5.3'
9+
- '5.4'
10+
- '5.5'
11+
- '7.0'
12+
- hhvm
13+
14+
matrix:
15+
allow_failures:
16+
- php: hhvm
17+
18+
install:
19+
- composer install
20+
21+
before_script:
22+
- mkdir -p build/logs
23+
24+
script:
25+
- phpunit --coverage-clover build/logs/clover.xml
26+
27+
after_success:
28+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then CODECLIMATE_REPO_TOKEN=e5b90070ffaf6d10a8324e79f66fc294f440604afa146611e4876ec0524bed59 ./vendor/bin/test-reporter; fi;'

CONTRIBUTING.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Contributing to PHP Basic HTTP Client
2+
3+
## About
4+
5+
This document provides a set of best practices for contributions - bug reports, code submissions / pull requests, etc.
6+
7+
## Sources
8+
9+
This document is based on the open source document [Contributing to Open Source Projects](http://contribution-guide-org.readthedocs.org/) by [Jeff Forcier](https://github.com/bitprophet).
10+
11+
## Submitting bugs
12+
13+
### Due diligence
14+
15+
Before submitting a bug, please do the following:
16+
17+
- Perform **basic troubleshooting** steps:
18+
- **Make sure you’re on the latest version.** If you’re not on the most recent version, your problem may have been solved already!
19+
Upgrading is always the best first step.
20+
- **Try older versions.** If you’re already on the latest release, try rolling back a few minor versions (e.g. if on 1.7, try 1.5 or 1.6) and see if the problem goes away. This will help the devs narrow down when the problem first arose in the commit log.
21+
- **Try switching up dependency versions.** If the software in question has dependencies (other libraries, etc) try upgrading / downgrading those as well.
22+
- **Search the project’s issue tracker** to make sure it’s not a known issue.
23+
24+
#### What to put in your bug report
25+
26+
Make sure your report gets the attention it deserves: bug reports with missing information may be ignored or punted back to you, delaying a fix. The below constitutes a bare minimum; more info is almost always better:
27+
28+
- **What PHP version** are you using?
29+
- **Which additional core libraries and extensions** in which versions are available?
30+
- **What operating system in which version are you on?** Again, more detail is better.
31+
- **Which version of the software are you using?** Ideally, you followed the advice above and have ruled out (or verified that the problem exists in) a few different versions.
32+
- **How can the developers recreate the bug on their end?** If possible, include a copy of your code, the command you used to invoke it, and the full output of your run (if applicable.)
33+
A common tactic is to pare down your code until a simple (but still bug-causing) “base case” remains. Not only can this help you identify problems which aren’t real bugs, but it means the developer can get to fixing the bug faster.
34+
35+
## Contributing changes
36+
37+
### Version control branching
38+
39+
Always **make a new branch** for your work, no matter how small. This makes it easy for others to take just that one set of changes from your repository, in case you have multiple unrelated changes floating around.
40+
41+
- A corollary: **don’t submit unrelated changes in the same branch / pull request!** The maintainer shouldn’t have to reject your awesome bugfix because the feature you put in with it needs more review.
42+
43+
**Base your new branch off of the appropriate branch** on the main repository:
44+
45+
- **Bug fixes** should be based on the branch named after the oldest supported release line the bug affects.
46+
- E.g. if a feature was introduced in 1.1, the latest release line is 1.3, and a bug is found in that feature - make your branch based on 1.1. The maintainer will then forward-port it to 1.3 and master.
47+
- Bug fixes requiring large changes to the code or which have a chance of being otherwise disruptive, may need to base off of `master` instead. This is a judgement call – ask the devs!
48+
- **New features** should branch off of **the `master` branch.**
49+
- Note that depending on how long it takes for the dev team to merge your patch, the copy of `master` you worked off of may get out of date! If you find yourself ‘bumping’ a pull request that’s been sidelined for a while, **make sure you rebase or merge to latest `master`** to ensure a speedier resolution.
50+
51+
### Code formatting
52+
53+
**Follow the style you see used in the primary repository!** Consistency with the rest of the project always trumps other considerations. It doesn’t matter if you have your own style or if the rest of the code breaks with the greater community - just follow along.
54+
55+
PHP projects usually follow the [PHP Standards Recommendations guidelines](http://www.php-fig.org/psr/) (though many have minor deviations depending on the lead maintainers’ preferences.)
56+
57+
### Documentation isn’t optional
58+
59+
It’s not! Patches without documentation will be returned to sender. By “documentation” we mean:
60+
61+
- **Docstrings / DocBlocks** must be created or updated for public and private API methods.
62+
- New features should ideally include **a brief description of business logic,** including useful example code snippets.
63+
- All submissions should have **changelog styled commit and pull request messages** crediting the contributor and / or any individuals instrumental in identifying the problem.
64+
65+
### Tests aren’t optional
66+
67+
Any bugfix that doesn’t include a test proving the existence of the bug being fixed, may be suspect. Ditto for new features that can’t prove they actually work.
68+
69+
We’ve found that test-first development really helps make features better architected and identifies potential edge cases earlier instead of later. Writing tests before the implementation is strongly encouraged.
70+
71+
## Full example
72+
73+
Here’s an example workflow for `php-basic-http-client` hosted on Github, which is currently in version 1.0.2. Your username is `yourname` and you’re submitting a basic bugfix.
74+
75+
### Preparing your Fork
76+
77+
- Hit ‘fork’ on Github, creating e.g. `yourname/php-basic-http-client`
78+
- Clone your project
79+
80+
```
81+
git clone git@github.com:yourname/php-basic-http-client
82+
```
83+
84+
- Create a branch
85+
86+
```
87+
cd php-basic-http-client
88+
git checkout -b fix-issue-269 1.0.0
89+
```
90+
91+
### Making your Changes
92+
93+
- Write tests expecting the correct / fixed functionality; make sure they fail.
94+
- Hack, hack, hack.
95+
- Run tests again, making sure they pass.
96+
- Commit your changes
97+
98+
```
99+
git commit -m "Changelog styled commit message crediting yourself"
100+
```
101+
102+
### Creating Pull Requests
103+
104+
- Push your commit to get it back up to your fork
105+
106+
```
107+
git push origin HEAD
108+
```
109+
110+
- Visit Github, click handy “Pull request” button that it will make upon noticing your new branch.
111+
- In the description field, write down issue number (if submitting code fixing an existing issue) or describe the issue + your fix (if submitting a wholly new bugfix).
112+
- Hit ‘submit’! And please be patient - the maintainers will get to you when they can.
113+

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,45 @@
1-
# php-basic-http-client
1+
# PHP Basic HTTP Client
2+
3+
[![Build Status](https://travis-ci.org/markenwerk/php-basic-http-client.svg?branch=master)](https://travis-ci.org/markenwerk/php-basic-http-client)
4+
[![Test Coverage](https://codeclimate.com/github/markenwerk/php-basic-http-client/badges/coverage.svg)](https://codeclimate.com/github/markenwerk/php-basic-http-client/coverage)
5+
[![Dependency Status](https://www.versioneye.com/user/projects/571f7843fcd19a0039f18149/badge.svg)](https://www.versioneye.com/user/projects/571f7843fcd19a0039f18149)
6+
[![Code Climate](https://codeclimate.com/github/markenwerk/php-basic-http-client/badges/gpa.svg)](https://codeclimate.com/github/markenwerk/php-basic-http-client)
7+
[![Latest Stable Version](https://poser.pugx.org/markenwerk/basic-http-client/v/stable)](https://packagist.org/packages/markenwerk/basic-http-client)
8+
[![Total Downloads](https://poser.pugx.org/markenwerk/basic-http-client/downloads)](https://packagist.org/packages/markenwerk/basic-http-client)
9+
[![License](https://poser.pugx.org/markenwerk/basic-http-client/license)](https://packagist.org/packages/markenwerk/basic-http-client)
10+
211
A PHP HTTP client library supporting different protocols like RESTful JSON, JSON-RPC, XML-RPC and SOAP.
12+
13+
## Installation
14+
15+
```{json}
16+
{
17+
"require": {
18+
"markenwerk/basic-http-client": "~1.0"
19+
}
20+
}
21+
```
22+
23+
## Usage
24+
25+
### Autoloading and namesapce
26+
27+
```{php}
28+
require_once('path/to/vendor/autoload.php');
29+
```
30+
31+
---
32+
33+
## Exception handling
34+
35+
PHP Basic HTTP Client provides different exceptions – also provided by the PHP Common Exceptions project – for proper handling.
36+
You can find more information about [PHP Common Exceptions at Github](https://github.com/markenwerk/php-common-exceptions).
37+
38+
## Contribution
39+
40+
Contributing to our projects is always very appreciated.
41+
**But: please follow the contribution guidelines written down in the [CONTRIBUTING.md](https://github.com/markenwerk/php-basic-http-client/blob/master/CONTRIBUTING.md) document.**
42+
43+
## License
44+
45+
PHP Basic HTTP Client is under the MIT license.

composer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "markenwerk/basic-http-client",
3+
"type": "library",
4+
"description": "A PHP HTTP client library supporting different protocols like RESTful JSON, JSON-RPC, XML-RPC and SOAP.",
5+
"keywords": [
6+
"HTTP client",
7+
"RESTful",
8+
"JSON",
9+
"JSON-RPC",
10+
"XML-RPC",
11+
"SOAP",
12+
"SSL"
13+
],
14+
"homepage": "http://markenwerk.net/",
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "Martin Brecht-Precht",
19+
"email": "mb@markenwerk.net",
20+
"homepage": "http://markenwerk.net"
21+
}
22+
],
23+
"autoload": {
24+
"psr-4": {
25+
"BasicHttpClient\\": "src/"
26+
}
27+
},
28+
"require": {
29+
"php": ">=5.3",
30+
"markenwerk/common-exceptions": "~2.0"
31+
},
32+
"require-dev": {
33+
"phpunit/phpunit": "~4.8",
34+
"codeclimate/php-test-reporter": "dev-master"
35+
}
36+
}

phpunit.xml.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit colors="true" bootstrap="vendor/autoload.php">
3+
<testsuites>
4+
<testsuite name="Basic HTTP Client Testsuite">
5+
<directory>test</directory>
6+
</testsuite>
7+
</testsuites>
8+
<filter>
9+
<whitelist>
10+
<directory suffix=".php">./src</directory>
11+
<exclude>
12+
<directory>./vendor</directory>
13+
<directory>./test</directory>
14+
</exclude>
15+
</whitelist>
16+
</filter>
17+
</phpunit>

0 commit comments

Comments
 (0)