Skip to content

Commit 53d0dee

Browse files
Merge pull request #3 from asdfdotdev/development
Refactor to package
2 parents 3b20d42 + 06d10bb commit 53d0dee

24 files changed

Lines changed: 3248 additions & 862 deletions

.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+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.yml]
15+
indent_size = 2

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
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, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@asdf.dev. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Contributing to session
2+
3+
**Find a bug?**
4+
5+
- If the bug is security related please do not submit a GitHub issue. Email hello@asdf.dev with details and we will be in touch.
6+
7+
- All other bug should be [submitted via GitHub](https://github.com/asdfdotdev/session/issues) issues. Please follow the provided template and include as much detail as possible.
8+
- Before submtiting a new issue please make sure it hasn't previously been reported by searching existing issues.
9+
10+
**Fix a bug, add something cool, or make a change?**
11+
12+
- [Submit a pull request](https://github.com/asdfdotdev/session/pulls) so we can add it!
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve session
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
12+
A clear and concise description of what the bug is.
13+
14+
**To Reproduce**
15+
16+
Steps to reproduce the behavior:
17+
18+
19+
**Expected behavior**
20+
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
25+
If applicable, add screenshots to help explain your problem.
26+
27+
28+
**System Information**
29+
30+
- session class version:
31+
- Operating System:
32+
- Python Version:
33+
34+
35+
**Additional context**
36+
37+
Add any other context about the problem here.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
12+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13+
14+
**Describe the solution you'd like**
15+
16+
A clear and concise description of what you want to happen.
17+
18+
**Describe alternatives you've considered**
19+
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
**Additional context**
23+
24+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Description
2+
3+
Please include a summary of the change and which GitHub issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
Please describe the type of change.
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] This change requires a documentation update
15+
16+
# How Has This Been Tested?
17+
18+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/.DS_Store
2+
.idea
3+
**/_tests/build/**/*
4+
vendor/
5+
_dev/

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
language: php
2+
3+
notifications:
4+
email:
5+
on_success: never
6+
on_failure: change
7+
8+
branches:
9+
only:
10+
- master
11+
- development
12+
13+
cache:
14+
directories:
15+
- $HOME/.composer/cache
16+
17+
matrix:
18+
include:
19+
- php: 7.1
20+
- php: 7.2
21+
- php: 7.3
22+
23+
before_script:
24+
- composer install
25+
- ./vendor/bin/phpcs --version
26+
- ./vendor/bin/phpcs -i
27+
- ./vendor/bin/phpcs src/* --report=summary --standard=PSR2
28+
- ./vendor/bin/phpcs src/* --report=summary --standard=PSR12
29+
- ./vendor/bin/phpcs --standard=PHPCompatibility -p --runtime-set testVersion 7.1- src/*
30+
31+
script:
32+
- cd _tests
33+
- mkdir -p build/logs
34+
- ../vendor/bin/phpunit
35+
36+
after_success:
37+
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Session
2+
3+
[![Build Status](https://travis-ci.org/asdfdotdev/session.svg?branch=master)](https://travis-ci.org/asdfdotdev/session) [![codecov](https://codecov.io/gh/asdfdotdev/session/branch/master/graph/badge.svg)](https://codecov.io/gh/asdfdotdev/session) [![Packagist](https://img.shields.io/packagist/dm/asdfdotdev/session)](https://packagist.org/packages/asdfdotdev/session)
4+
5+
This class endeavors to make it easy to use basic session best practices in PHP scripts.
6+
7+
* Easily set, increment, append, hash, and drop session values
8+
* Custom session naming
9+
* Session fingerprint validation
10+
* Regenerate session id at random intervals
11+
* Change session id length & bits per character*
12+
* HTTPOnly session cookie
13+
* Decoy PHPSESSID cookie
14+
* Easy to create, manage, and destroy session values
15+
* Force session strict mode*
16+
* Force session use only cookies*
17+
* Force HTTPS only session cookies*
18+
* Supports in PHP 7.1+
19+
20+
<sup>\* Requires access to `ini_set()` method.</sup>
21+
22+
### Compatibility
23+
24+
[![PHP Compatibility](https://img.shields.io/badge/PHP-7.1_to_7.3-%238892BF.svg?logo=php)](https://php.net/)
25+
26+
Session class is developed for and tested with recent PHP Version:
27+
28+
- PHP 7.1, 7.2, and 7.3
29+
30+
31+
## Installation
32+
33+
```
34+
composer require asdfdotdev/session
35+
```
36+
37+
## Use
38+
39+
A number of usage examples are included in `_examples/`. Check out the examples [README](./_examples/README.md) for further details.
40+
41+
## Tests
42+
43+
Information regarding the included tests is available in the tests the [README](./_test#readme).
44+
45+
[Build history can be browsed at Travis-CI.](https://travis-ci.org/asdfdotdev/session)
46+
47+
## Standards
48+
49+
This class follows both the [PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-12](https://www.php-fig.org/psr/psr-12/) code standards.
50+
51+
## Debugging
52+
53+
By default basic checks are performed when creating a session:
54+
55+
- **Session Lifespan:** Prevents min lifespan from being greater than max lifespan.
56+
- **System Timezone:** Confirms default timezone is configured for PHP, if not UTC is set.
57+
58+
Additional optional debugging can be enabled in session settings:
59+
60+
- **PHP Version:** Confirms the version available is 7.1.0 or newer
61+
- **Session Directory:** Confirms write access to PHP session directory
62+
- **Session Domain:** Confirms session domain setting matches the request domain
63+
64+
## Contributing
65+
66+
Feedback, bug reports, feature requests, and pull requests are welcome!
67+
68+
If you'd like to contribute please reference our [code of conduct](./.github/CODE_OF_CONDUCT.md) and [contributing](./.github/CONTRIBUTING.md) guides.

ReadMe.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)