Skip to content

Commit dba968b

Browse files
committed
Initial commit
0 parents  commit dba968b

File tree

18 files changed

+610
-0
lines changed

18 files changed

+610
-0
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4
8+
9+
[*.md]
10+
max_line_length = 80

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.github export-ignore
2+
tests export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
phpstan.neon export-ignore
6+
phpunit.xml export-ignore

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Continuous Integration
2+
3+
'on':
4+
push:
5+
branches: [ main ]
6+
pull_request: ~
7+
8+
jobs:
9+
ci:
10+
name: Run the test suite
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
php-versions:
15+
- '8.1'
16+
- '8.2'
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '${{ matrix.php-versions }}'
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate --strict
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress
31+
32+
- name: Install PHP CS Fixer
33+
run: composer install --prefer-dist --no-progress --working-dir=tools/php-cs-fixer
34+
35+
- name: Run PHP CS Fixer
36+
run: composer cs-check
37+
38+
- name: Install PHPStan
39+
run: composer install --prefer-dist --no-progress --working-dir=tools/phpstan
40+
41+
- name: Run PHPStan
42+
run: composer phpstan
43+
44+
- name: Run tests
45+
run: composer test

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
.phpunit.cache
3+
.php-cs-fixer.cache
4+
.phpstan-cache
5+
composer.lock
6+
vendor

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## Not released yet
4+
5+
* Initial release

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing
2+
3+
First of all, **thank you** for contributing, **you are awesome**!
4+
5+
Everybody should be able to help. Here's how you can do it:
6+
7+
1. [Fork it](https://github.com/jolicode/php-os-helper/fork_select)
8+
2. improve it
9+
3. submit a [pull request](https://help.github.com/articles/creating-a-pull-request)
10+
11+
Here's some tips to make you the best contributor ever:
12+
13+
* [Rules](#rules)
14+
* [Green tests](#green-tests)
15+
* [Standard code](#standard-code)
16+
* [Keeping your fork up-to-date](#keeping-your-fork-up-to-date)
17+
18+
## Rules
19+
20+
Here are a few rules to follow in order to ease code reviews, and discussions
21+
before maintainers accept and merge your work.
22+
23+
* You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
24+
[PSR-12](http://www.php-fig.org/psr/12/) (see [Standard code](#standard-code)).
25+
* You MUST run the test suite (see [Green tests](#green-tests)).
26+
* You MUST write (or update) tests.
27+
* You SHOULD write documentation.
28+
29+
Please, write [commit messages that make
30+
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
31+
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
32+
before submitting your Pull Request (see also how to [keep your
33+
fork up-to-date](#keeping-your-fork-up-to-date)).
34+
35+
One may ask you to [squash your
36+
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
37+
too. This is used to "clean" your Pull Request before merging it (we don't want
38+
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
39+
40+
Also, while creating your Pull Request on GitHub, you MUST write a description
41+
which gives the context and/or explains why you are creating it.
42+
43+
Your work will then be reviewed as soon as possible (suggestions about some
44+
changes, improvements or alternatives may be given).
45+
46+
## Green tests
47+
48+
Run the tests using the following script:
49+
50+
```shell
51+
vendor/bin/simple-phpunit
52+
```
53+
54+
## Standard code
55+
56+
Use [PHP CS fixer](http://cs.sensiolabs.org/) to make your code compliant with
57+
php-os-helper's coding standards:
58+
59+
```shell
60+
php-cs-fixer fix
61+
```
62+
63+
## Keeping your fork up-to-date
64+
65+
To keep your fork up-to-date, you should track the upstream (original) one
66+
using the following command:
67+
68+
69+
```shell
70+
git remote add upstream https://github.com/jolicode/php-os-helper.git
71+
```
72+
73+
Then get the upstream changes:
74+
75+
```shell
76+
git checkout main
77+
git pull --rebase origin main
78+
git pull --rebase upstream main
79+
git checkout <your-branch>
80+
git rebase main
81+
```
82+
83+
Finally, publish your changes:
84+
85+
```shell
86+
git push -f origin <your-branch>
87+
```
88+
89+
Your pull request will be automatically updated.
90+
91+
Thank you!

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023-present JoliCode
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.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# PHP OS Helper
2+
3+
This library provides some helpers to detect OS of the machine where PHP is running.
4+
5+
## Installation
6+
7+
```bash
8+
$ composer require jolicode/php-os-helper
9+
```
10+
11+
## Usage
12+
13+
```php
14+
<?php
15+
16+
use JoliCode\PhpOsHelper\OsHelper;
17+
18+
OsHelper::isUnix(); // true or false
19+
OsHelper::isWindows(); // true or false
20+
OsHelper::isWindowsSeven(); // true or false
21+
OsHelper::isWindowsEightOrHigher(); // true or false
22+
OsHelper::isWindowsSubsystemForLinux(); // true or false
23+
OsHelper::isMacOs(); // true or false
24+
OsHelper::getMacOSVersion(); // 10.15.7
25+
```
26+
27+
## Notes
28+
29+
This package contains helpers extracted from https://github.com/jolicode/JoliNotif
30+
to make them standalone.

VERSIONING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Versioning and branching models
2+
3+
This file explains the versioning and branching models of this project.
4+
5+
## Versioning
6+
7+
The versioning is inspired by [Semantic Versioning](http://semver.org/):
8+
9+
> Given a version number MAJOR.MINOR.PATCH, increment the:
10+
>
11+
> 1. MAJOR version when you make incompatible API changes
12+
> 2. MINOR version when you add functionality in a backwards-compatible manner
13+
> 3. PATCH version when you make backwards-compatible bug fixes
14+
15+
## Branching Model
16+
17+
The branching is inspired by [@jbenet](https://github.com/jbenet)
18+
[simple git branching model](https://gist.github.com/jbenet/ee6c9ac48068889b0912):
19+
20+
> 1. `main` must always be deployable.
21+
> 2. **all changes** are made through feature branches (pull-request + merge)
22+
> 3. rebase to avoid/resolve conflicts; merge in to `main`

0 commit comments

Comments
 (0)