Skip to content

Commit 4b9e4ea

Browse files
committed
first commit
0 parents  commit 4b9e4ea

File tree

13 files changed

+388
-0
lines changed

13 files changed

+388
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto eol=lf
2+
3+
/tests export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.travis.yml export-ignore
8+
phpunit.xml export-ignore
9+
phpcs.xml export-ignore

.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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: php
2+
sudo: false
3+
4+
php:
5+
- 5.6
6+
- 7.0
7+
- 7.1
8+
9+
before_script:
10+
- composer self-update
11+
- composer install -n
12+
13+
script:
14+
- composer test

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
## 0.1.0 - 2016-10-08
8+
9+
First version

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing Guide
2+
3+
This project adheres to [The Code Manifesto](http://codemanifesto.com) as its guidelines for contributor interactions.
4+
5+
## The Code Manifesto
6+
7+
We want to work in an ecosystem that empowers developers to reach their potential--one that encourages growth and effective collaboration. A space that is safe for all.
8+
9+
A space such as this benefits everyone that participates in it. It encourages new developers to enter our field. It is through discussion and collaboration that we grow, and through growth that we improve.
10+
11+
In the effort to create such a place, we hold to these values:
12+
13+
1. **Discrimination limits us.** This includes discrimination on the basis of race, gender, sexual orientation, gender identity, age, nationality, technology and any other arbitrary exclusion of a group of people.
14+
2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort levels. Remember that, and if brought to your attention, heed it.
15+
3. **We are our biggest assets.** None of us were born masters of our trade. Each of us has been helped along the way. Return that favor, when and where you can.
16+
4. **We are resources for the future.** As an extension of #3, share what you know. Make yourself a resource to help those that come after you.
17+
5. **Respect defines us.** Treat others as you wish to be treated. Make your discussions, criticisms and debates from a position of respectfulness. Ask yourself, is it true? Is it necessary? Is it constructive? Anything less is unacceptable.
18+
6. **Reactions require grace.** Angry responses are valid, but abusive language and vindictive actions are toxic. When something happens that offends you, handle it assertively, but be respectful. Escalate reasonably, and try to allow the offender an opportunity to explain themselves, and possibly correct the issue.
19+
7. **Opinions are just that: opinions.** Each and every one of us, due to our background and upbringing, have varying opinions. That is perfectly acceptable. Remember this: if you respect your own opinions, you should respect the opinions of others.
20+
8. **To err is human.** You might not intend it, but mistakes do happen and contribute to build experience. Tolerate honest mistakes, and don't hesitate to apologize if you make one yourself.
21+
22+
## How to contribute
23+
24+
This is a collaborative effort. We welcome all contributions submitted as pull requests.
25+
26+
(Contributions on wording & style are also welcome.)
27+
28+
### Bugs
29+
30+
A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful – thank you!
31+
32+
Please try to be as detailed as possible in your report. Include specific information about the environment – version of PHP, etc, and steps required to reproduce the issue.
33+
34+
### Pull Requests
35+
36+
Good pull requests – patches, improvements, new features – are a fantastic help. Before create a pull request, please follow these instructions:
37+
38+
* The code must follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `composer cs-fix` to fix your code before commit.
39+
* Write tests
40+
* Document any change in `README.md` and `CHANGELOG.md`
41+
* One pull request per feature. If you want to do more than one thing, send multiple pull request
42+
43+
### Runing tests
44+
45+
```sh
46+
composer test
47+
```

LICENSE

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

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# middlewares/aura-session
2+
3+
[![Latest Version on Packagist][ico-version]][link-packagist]
4+
[![Software License][ico-license]](LICENSE.md)
5+
[![Build Status][ico-travis]][link-travis]
6+
[![Quality Score][ico-scrutinizer]][link-scrutinizer]
7+
[![Total Downloads][ico-downloads]][link-downloads]
8+
[![SensioLabs Insight][ico-sensiolabs]][link-sensiolabs]
9+
10+
Middleware to manage sessions using [Aura.Session](https://github.com/auraphp/Aura.Session).
11+
12+
**Note:** This middleware is intended for server side only
13+
14+
## Requirements
15+
16+
* PHP >= 5.6
17+
* A [PSR-7](https://packagist.org/providers/psr/http-message-implementation) http mesage implementation ([Diactoros](https://github.com/zendframework/zend-diactoros), [Guzzle](https://github.com/guzzle/psr7), [Slim](https://github.com/slimphp/Slim), etc...)
18+
* A [PSR-15](https://github.com/http-interop/http-middleware) middleware dispatcher ([Middleman](https://github.com/mindplay-dk/middleman), etc...)
19+
20+
## Installation
21+
22+
This package is installable and autoloadable via Composer as [middlewares/aura-session](https://packagist.org/packages/middlewares/aura-session).
23+
24+
```sh
25+
composer require middlewares/aura-session
26+
```
27+
28+
## Example
29+
30+
```php
31+
$dispatcher = new Dispatcher([
32+
new Middlewares\AuraSession(),
33+
34+
function ($request) {
35+
//get the session object
36+
$session = $request->getAttribute('session');
37+
}
38+
]);
39+
40+
$response = $dispatcher->dispatch(new ServerRequest());
41+
```
42+
43+
## Options
44+
45+
#### `__construct(Aura\Session\SessionFactory $factory = null)`
46+
47+
To use a custom session factory. If it's not passed, it will be created automatically.
48+
49+
#### `name(string $name)`
50+
51+
The session name. If it's not defined, the default `PHPSESSID` will be used.
52+
53+
#### `attribute(string $attribute)`
54+
55+
The attribute name used to store the session in the session request. By default is `session`.
56+
57+
---
58+
59+
Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.
60+
61+
The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.
62+
63+
[ico-version]: https://img.shields.io/packagist/v/middlewares/aura-session.svg?style=flat-square
64+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
65+
[ico-travis]: https://img.shields.io/travis/middlewares/aura-session/master.svg?style=flat-square
66+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/middlewares/aura-session.svg?style=flat-square
67+
[ico-downloads]: https://img.shields.io/packagist/dt/middlewares/aura-session.svg?style=flat-square
68+
[ico-sensiolabs]: https://img.shields.io/sensiolabs/i/36786f5a-2a15-4399-8817-8f24fcd8c0b4.svg?style=flat-square
69+
70+
[link-packagist]: https://packagist.org/packages/middlewares/aura-session
71+
[link-travis]: https://travis-ci.org/middlewares/aura-session
72+
[link-scrutinizer]: https://scrutinizer-ci.com/g/middlewares/aura-session
73+
[link-downloads]: https://packagist.org/packages/middlewares/aura-session
74+
[link-sensiolabs]: https://insight.sensiolabs.com/projects/36786f5a-2a15-4399-8817-8f24fcd8c0b4

composer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "middlewares/aura-session",
3+
"type": "library",
4+
"description": "Middleware to manage sessions using Aura.Session",
5+
"license": "MIT",
6+
"keywords": [
7+
"psr-7",
8+
"psr-15",
9+
"middleware",
10+
"server",
11+
"http",
12+
"session",
13+
"aura.session"
14+
],
15+
"homepage": "https://github.com/middlewares/aura-session",
16+
"support": {
17+
"issues": "https://github.com/middlewares/aura-session/issues"
18+
},
19+
"require": {
20+
"php": "^5.6 || ^7.0",
21+
"http-interop/http-middleware": "^0.2",
22+
"aura/session": "^2.1"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": "^5.5",
26+
"zendframework/zend-diactoros": "^1.3",
27+
"friendsofphp/php-cs-fixer": "^1.12",
28+
"squizlabs/php_codesniffer": "^2.7",
29+
"mindplay/middleman": "^2.0"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"Middlewares\\": "src/"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"Middlewares\\Tests\\": "tests/"
39+
}
40+
},
41+
"scripts": {
42+
"test": [
43+
"phpunit",
44+
"phpcs"
45+
],
46+
"cs-fix": "php-cs-fixer fix . --fixers=-psr0"
47+
}
48+
}

phpcs.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Middlewares coding standard">
3+
<description>Middlewares coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="colors"/>
8+
9+
<!-- coding standard -->
10+
<rule ref="PSR2"/>
11+
12+
<!-- Paths to check -->
13+
<file>src</file>
14+
<file>tests</file>
15+
</ruleset>

0 commit comments

Comments
 (0)