Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Dec 17, 2023
0 parents commit 495f6a9
Show file tree
Hide file tree
Showing 44 changed files with 1,903 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* text=auto

/.github export-ignore
/doc export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/CODE_OF_CONDUCT.md export-ignore
/README.md export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
27 changes: 27 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributing

First of all, **thank you** for contributing.

Bugs or feature requests can be posted online on the GitHub issues section of the project.

Few rules to ease code reviews and merges:

- You MUST follow the [PSR-12](http://www.php-fig.org/psr/psr-12/) coding standards.
- You MUST run the test suite.
- You MUST write (or update) unit tests when bugs are fixed or features are added.
- You SHOULD write documentation.

To contribute use [Pull Requests](https://help.github.com/articles/using-pull-requests), please, write commit messages that make sense, and rebase your branch before submitting your PR.

May be asked to squash your commits too. This is used to "clean" your Pull Request before merging it, avoiding commits such as fix tests, fix 2, fix 3, etc.

Run test suite
------------

* install composer: `curl -s http://getcomposer.org/installer | php`
* install dependencies: `php composer.phar install`
* run tests: `vendor/bin/phpunit`
* check and fix coding standards:
* `vendor/bin/phpstan analyse`
* `vendor/bin/rector process`
* `vendor/bin/ecs check --fix`
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: Spomky
patreon: FlorentMorselli
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 🐛 Bug Report
about: ⚠️ See below for security reports
labels: Bug

---

**Version(s) affected**: x.y.z

**Description**
<!-- A clear and concise description of the problem. -->

**How to reproduce**
<!-- Code and/or config needed to reproduce the problem. If it's a complex bug,
create a "bug reproducer" as explained in: -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

**Additional context**
<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: 🚀 Feature Request
about: Ideas for new features and improvements

---

**Description**
<!-- A clear and concise description of the new feature. -->

**Example**
<!-- A simple example of the new feature in action (include PHP code, YAML config, etc.)
If the new feature changes an existing feature, include a simple before/after comparison. -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/3_Documentation_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: 📖 Documentation Issue
about: To report typo or obsolete section in the documentation

---
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support Question
url: https://spomky-labs.com/contact/
about: We use GitHub issues only to discuss about bugs and new features. For this kind of questions about using the library, please use Stackoverflow (or similar) or send a quote request at https://spomky-labs.com/contact/
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
| Q | A
| ------------- | ---
| Branch? | <!-- see below -->
| Bug fix? | yes/no
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally:
- Always add tests and ensure they pass.
- Never break backward compatibility (unless you are working on the next major release branch).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the last major branch (e.g. 1.x).
-->
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
8 changes: 8 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
daysUntilStale: 60
daysUntilClose: 7
staleLabel: wontfix
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: false
32 changes: 32 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Coding Standards

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: CODING STANDARDS
run: make ci-cs
29 changes: 29 additions & 0 deletions .github/workflows/rector_checkstyle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Rector Checkstyle

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: ['8.2']
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring
coverage: none

- name: Install Composer dependencies
run: composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader

- name: Rector
run: make rector
32 changes: 32 additions & 0 deletions .github/workflows/static-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Static Analyze

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.2']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: PHPStan
run: make st
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Unit and Functional Tests

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: ['8.2', '8.3']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Run tests
run: make tests
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/composer.lock
/.phpunit.result.cache
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. 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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2018 Spomky-Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.PHONY: tests
tests: vendor ## Run all tests
vendor/bin/phpunit --color

.PHONY: code-coverage-html
cc: vendor ## Show test coverage rates (HTML)
vendor/bin/phpunit --coverage-html ./build

.PHONY: cs
cs: vendor ## Fix all files using defined ECS rules
vendor/bin/ecs check --fix

.PHONY: tu
tu: vendor ## Run only unit tests
vendor/bin/phpunit --color --group Unit

.PHONY: ti
ti: vendor ## Run only integration tests
vendor/bin/phpunit --color --group Integration

.PHONY: tf
tf: vendor ## Run only functional tests
vendor/bin/phpunit --color --group Functional

.PHONY: st
st: vendor ## Run static analyse
vendor/bin/phpstan analyse


################################################

.PHONY: ci-cc
ci-cc: vendor ## Show test coverage rates (console)

.PHONY: ci-cs
ci-cs: vendor ## Check all files using defined ECS rules
vendor/bin/ecs check

################################################


vendor: composer.json composer.lock
composer validate
composer install
.PHONY: rector
rector: vendor ## Check all files using Rector
vendor/bin/rector process --ansi --dry-run --xdebug

.DEFAULT_GOAL := help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help
Loading

0 comments on commit 495f6a9

Please sign in to comment.