Skip to content
Permalink
Browse files

Init commit

  • Loading branch information...
Nyholm committed Jul 28, 2018
0 parents commit d528b9b68864cfc3b4df9dc5559a3df5d30a810b
Showing with 397 additions and 0 deletions.
  1. +9 −0 .editorconfig
  2. +9 −0 .gitattributes
  3. +4 −0 .gitignore
  4. +12 −0 .php_cs
  5. +8 −0 .scrutinizer.yml
  6. +12 −0 .styleci.yml
  7. +38 −0 .travis.yml
  8. +7 −0 CHANGELOG.md
  9. +31 −0 README.md
  10. +35 −0 composer.json
  11. +14 −0 phpunit.xml.dist
  12. +218 −0 src/ServerRequestCreator.php
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@@ -0,0 +1,9 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
/.php_cs export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
@@ -0,0 +1,4 @@
/.php_cs.cache
/composer.lock
/phpunit.xml
/vendor/
12 .php_cs
@@ -0,0 +1,12 @@
<?php
$config = PhpCsFixer\Config::create()
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->name('*.php')
)
;
return $config;
@@ -0,0 +1,8 @@
filter:
excluded_paths: [vendor/*, Tests/*]
checks:
php:
code_rating: true
duplication: true
tools:
external_code_coverage: true
@@ -0,0 +1,12 @@
preset: symfony

finder:
exclude:
- "Resources"
- "vendor"

enabled:
- short_array_syntax

disabled:
- phpdoc_annotation_without_dot # This is still buggy: https://github.com/symfony/symfony/pull/19198
@@ -0,0 +1,38 @@
language: php
sudo: false

cache:
directories:
- $HOME/.composer/cache

php:
- 7.1
- 7.2
- nightly

env:
global:
- TEST_COMMAND="composer test"

branches:
except:
- /^analysis-.*$/

matrix:
fast_finish: true
allow_failures:
- php: nightly
include:
- php: 7.1
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"

install:
- composer update ${COMPOSER_FLAGS} --prefer-source --no-interaction

script:
- $TEST_COMMAND

after_success:
- if [[ "$COVERAGE" = true ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$COVERAGE" = true ]]; then php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml; fi

@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 0.1.0 - Unreleased

First release
@@ -0,0 +1,31 @@
# PSR-7 implementation

[![Latest Version](https://img.shields.io/github/release/nyholm/psr7-server.svg?style=flat-square)](https://github.com/nyholm/psr7-server/releases)
[![Build Status](https://img.shields.io/travis/nyholm/psr7-server/master.svg?style=flat-square)](https://travis-ci.org/nyholm/psr7-server)
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/nyholm/psr7-server.svg?style=flat-square)](https://scrutinizer-ci.com/g/nyholm/psr7-server)
[![Quality Score](https://img.shields.io/scrutinizer/g/nyholm/psr7-server.svg?style=flat-square)](https://scrutinizer-ci.com/g/nyholm/psr7-server)
[![Total Downloads](https://poser.pugx.org/nyholm/psr7-server/downloads)](https://packagist.org/packages/nyholm/psr7-server)
[![Monthly Downloads](https://poser.pugx.org/nyholm/psr7-server/d/monthly.png)](https://packagist.org/packages/nyholm/psr7-server)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

## Installation

```bash
composer require nyholm/psr7-server
```

## Usage

```php
$psr17Factory = new Nyholm\Psr7\Factory\Psr17Factory();
$serverRequestFactory = new Nyholm\Psr7\Factory\ServerRequestFactory();
$creator = new ServerRequestCreator(
$serverRequestFactory,
$psr17Factory,
$psr17Factory,
$psr17Factory
);
$serverRequest = $creator->fromGlobals();
```
@@ -0,0 +1,35 @@
{
"name": "nyholm/psr7-server",
"description": "Helper classes to handle PSR-7 server requests",
"license": "MIT",
"keywords": ["psr-7", "psr-17"],
"homepage": "http://tnyholm.se",
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
}
],
"require": {
"php": "^7.1",
"psr/http-message": "^1.0",
"http-interop/http-factory": "^0.4"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
"Nyholm\\Psr7Server\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Nyholm\\Psr7Server\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
}
}
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Unit tests">
<directory>tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit d528b9b

Please sign in to comment.
You can’t perform that action at this time.