Skip to content

Commit 3ed5acb

Browse files
committed
Remove our stream implementation and added metafiles
1 parent 0e229dd commit 3ed5acb

13 files changed

+339
-296
lines changed

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

Diff for: .gitattributes

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
spec/ export-ignore
2+
tests/ export-ignore
3+
.editorconfig export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
.php_cs export-ignore
7+
.scrutinizer.yml export-ignore
8+
.styleci.yml export-ignore
9+
.travis.yml export-ignore
10+
CONDUCT.md export-ignore
11+
CONTRIBUTING.md export-ignore
12+
phpspec.yml.ci export-ignore
13+
phpspec.yml.dist export-ignore
14+
phpunit.xml.dist export-ignore

Diff for: .gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.puli/
2+
build/
3+
vendor/
4+
composer.lock
5+
phpspec.yml
6+
phpunit.xml

Diff for: .php_cs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/*
4+
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
5+
* with composer.
6+
*
7+
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
8+
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
9+
*/
10+
11+
use SLLH\StyleCIBridge\ConfigBridge;
12+
13+
return ConfigBridge::create();

Diff for: .styleci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
preset: symfony
2+
3+
finder:
4+
exclude:
5+
- "spec"
6+
- "tests"
7+
path:
8+
- "src"
9+
10+
enabled:
11+
- short_array_syntax

Diff for: CONDUCT.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

Diff for: CONTRIBUTING.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Contributing
2+
3+
If you're here, you would like to contribute to this repository and you're really welcome!
4+
5+
6+
## Bug reports
7+
8+
If you find a bug or a documentation issue, please report it or even better: fix it :). If you report it,
9+
please be as precise as possible. Here is a little list of required information:
10+
11+
- Precise description of the bug
12+
- Details of your environment (for example: OS, PHP version, installed extensions)
13+
- Backtrace which might help identifing the bug
14+
15+
16+
## Security issues
17+
18+
If you discover any security related issues,
19+
please contact us at the [security email address](../../#security) instead of submitting an issue on Github.
20+
This allows us to fix the issue and release a security hotfix without publicly disclosing the vulnerability.
21+
22+
23+
## Feature requests
24+
25+
If you think a feature is missing, please report it or even better: implement it :). If you report it, describe the more
26+
precisely what you would like to see implemented and we will discuss what is the best approach for it. If you can do
27+
some research before submitting it and link the resources to your description, you're awesome! It will allow us to more
28+
easily understood/implement it.
29+
30+
31+
## Sending a Pull Request
32+
33+
If you're here, you are going to fix a bug or implement a feature and you're the best!
34+
To do it, first fork the repository, clone it and create a new branch with the following commands:
35+
36+
``` bash
37+
$ git clone git@github.com:your-name/repo-name.git
38+
$ git checkout -b feature-or-bug-fix-description
39+
```
40+
41+
Then install the dependencies through [Composer](https://getcomposer.org/):
42+
43+
``` bash
44+
$ composer install
45+
```
46+
47+
Write code and tests. When you are ready, run the tests.
48+
(This is usually [PHPUnit](http://phpunit.de/) or [PHPSpec](http://phpspec.net/))
49+
50+
``` bash
51+
$ composer test
52+
```
53+
54+
When you are ready with the code, tested it and documented it, you can commit and push it with the following commands:
55+
56+
``` bash
57+
$ git commit -m "Feature or bug fix description"
58+
$ git push origin feature-or-bug-fix-description
59+
```
60+
61+
**Note:** Please write your commit messages in the imperative and follow the
62+
[guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for clear and concise messages.
63+
64+
Then [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on GitHub.
65+
66+
Please make sure that each individual commit in your pull request is meaningful.
67+
If you had to make multiple intermediate commits while developing,
68+
please squash them before submitting with the following commands
69+
(here, we assume you would like to squash 3 commits in a single one):
70+
71+
``` bash
72+
$ git rebase -i HEAD~3
73+
```
74+
75+
If your branch conflicts with the master branch, you will need to rebase and repush it with the following commands:
76+
77+
``` bash
78+
$ git remote add upstream git@github.com:orga/repo-name.git
79+
$ git pull --rebase upstream master
80+
$ git push -f origin feature-or-bug-fix-description
81+
```
82+
83+
84+
## Coding standard
85+
86+
This repository follows the [PSR-2 standard](http://www.php-fig.org/psr/psr-2/) and so, if you want to contribute,
87+
you must follow these rules.
88+
89+
90+
## Semver
91+
92+
We are trying to follow [semver](http://semver.org/). When you are making BC breaking changes,
93+
please let us know why you think it is important.
94+
In this case, your patch can only be included in the next major version.
95+
96+
97+
## Code of Conduct
98+
99+
This project is released with a [Contributor Code of Conduct](CONDUCT.md).
100+
By participating in this project you agree to abide by its terms.

Diff for: LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2015 PHP HTTP Team <team@php-http.org>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Diff for: README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# PSR-7 Multipart Stream Builder
2+
3+
[![Latest Version](https://img.shields.io/github/release/php-http/multipart-stream-builder.svg?style=flat-square)](https://github.com/php-http/multipart-stream-builder/releases)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5+
[![Total Downloads](https://img.shields.io/packagist/dt/php-http/multipart-stream-builder.svg?style=flat-square)](https://packagist.org/packages/php-http/multipart-stream-builder)
6+
7+
**Factory interfaces for PSR-7 HTTP Message.**
8+
9+
10+
## Install
11+
12+
Via Composer
13+
14+
``` bash
15+
$ composer require php-http/multipart-stream-builder
16+
```
17+
18+
## Usage
19+
20+
```php
21+
$builder = new MultipartStreamBuilder();
22+
$builder
23+
->addResource('foo', $stream)
24+
->addResource('bar', fopen($filePath, 'r'), ['filename'=>'bar.png'])
25+
->addResource('foo', 'string', ['headers'=>['Content-Type'=>'text/plain']]);
26+
27+
$multipartStream = $builder->build();
28+
$boundary = $builder->getBoundary();
29+
30+
$request = MessageFactoryDiscovery::find()->createRequest(
31+
'POST',
32+
'http://example.com',
33+
['Content-Type'=>'multipart/form-data; boundary='.$boundary],
34+
$multipartStream
35+
);
36+
$response = HttpClientDiscovery::find()->sendRequest($request);
37+
```
38+
39+
## Documentation
40+
41+
Please see the [official documentation](http://php-http.readthedocs.org/en/latest/message-factory/).
42+
43+
44+
## Contributing
45+
46+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
47+
48+
49+
## Security
50+
51+
If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
52+
53+
54+
## License
55+
56+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

Diff for: composer.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "php-http/multipart-stream-builder",
3+
"description": "A builder class that help you create a multipart stream",
4+
"license": "MIT",
5+
"keywords": ["http", "factory", "message", "stream"],
6+
"homepage": "http://php-http.org",
7+
"authors": [
8+
{
9+
"name": "Tobias Nyholm",
10+
"email": "tobias.nyholm@gmail.com"
11+
}
12+
],
13+
"require": {
14+
"php": "^5.5|^7.0",
15+
"php-http/message-factory": "^1.0",
16+
"php-http/discovery": "^0.9"
17+
},
18+
"suggest": {
19+
"guzzlehttp/psr7":"To build the stream",
20+
"zendframework/zend-diactoros":"To build the stream"
21+
}
22+
"autoload": {
23+
"psr-4": {
24+
"Http\\Message\\": "src/"
25+
}
26+
},
27+
"extra": {
28+
"branch-alias": {
29+
"dev-master": "0.2-dev"
30+
}
31+
}
32+
}

Diff for: src/MimetypeHelper.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<?php
22

3-
namespace Http\MultipartStream;
3+
namespace Http\Message;
44

55
/**
6+
* This class helps to find the proper mime types. The source of this file is taken
7+
* from Guzzle.
8+
*
69
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
10+
* @author mtdowling and contributors to guzzlehttp/psr7
711
*/
812
class MimetypeHelper
913
{

0 commit comments

Comments
 (0)