Skip to content

Commit b6ff9ee

Browse files
committed
0 parents  commit b6ff9ee

32 files changed

+1807
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
charset = utf-8
6+
end_of_line = lf
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.py]
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.{yml,yaml}]
15+
indent_style = space
16+
indent_size = 2

.gitattributes

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/.build export-ignore
2+
/.github export-ignore
3+
/.phan export-ignore
4+
/.phpdoc export-ignore
5+
/docs export-ignore
6+
/examples export-ignore
7+
/tests export-ignore
8+
/.editorconfig export-ignore
9+
/.gitattributes export-ignore
10+
/.gitignore export-ignore
11+
/.readthedocs.yml export-ignore
12+
/composer.lock export-ignore
13+
/phpcs.xml.dist export-ignore
14+
/phpdoc.xml.dist export-ignore
15+
/phpmd.xml.dist export-ignore
16+
/phpunit.xml.dist export-ignore
17+
18+
*.php diff=php

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: codemasher

.github/ISSUE_TEMPLATE/bug_report.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Bug report
3+
about: You have found a bug? Does the library not behave as expected? That's great (ok, not that great)! Please help us to improve!
4+
title: '[BUG]'
5+
labels: 'bug'
6+
---
7+
8+
<!--
9+
Please FOLLOW THE ISSUE TEMPLATE unless you have a good reason not to.
10+
If you have a question or an issue that is not a bug,
11+
please use the Q&A section under discussions instead. Thanks!
12+
-->
13+
14+
**Describe the bug or unexpected behaviour**
15+
16+
A clear and concise description of what the bug is.
17+
18+
19+
**Steps to reproduce the behavior**
20+
21+
- When i do ...
22+
- The code below ...
23+
- Error message: ...
24+
25+
26+
**Code sample** (if applicable)
27+
28+
```php
29+
// your code here
30+
```
31+
32+
33+
**Expected behavior**
34+
35+
A clear and concise description of what you expected to happen.
36+
37+
38+
**Screenshots**
39+
40+
If applicable, add screenshots to help explain your problem.
41+
42+
43+
**Environment (please complete the following information):**
44+
45+
- PHP version/OS: [e.g. 7.4.12, Ubuntu 20.04]
46+
- Library version: [e.g. 4.3.1]
47+
48+
49+
**Additional context**
50+
51+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: "You have a question or an issue that is not a bug?"
4+
about: "Please use the Q&A section under discussions. Thanks!"
5+
url: https://github.com/chillerlan/php-library-template/discussions
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Feature request
3+
about: You have an idea for a new feature (or improve an existing one)? Great!
4+
title: '[ENHANCEMENT]'
5+
labels: 'enhancement'
6+
---
7+
8+
<!--
9+
Please FOLLOW THE ISSUE TEMPLATE unless you have a good reason not to.
10+
If you have a question or an issue that is not a feature request,
11+
please use the Q&A section under discussions instead. Thanks!
12+
-->
13+
14+
**Describe the feature**
15+
16+
A clear and concise description of the requested feature.
17+
18+
19+
**Code sample** (if applicable)
20+
21+
```php
22+
// your code here
23+
```
24+
25+
26+
**Additional context**
27+
28+
Add any other context here (if applicable).
29+
30+
31+
**Are you (the requester) willing to submit a pull request for that feature?**
32+
33+
[YES|NO] (A yes will greatly increase the chance that the feature will be added)

.github/PULL_REQUEST_TEMPLATE.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Proposed changes
2+
3+
<!-- Describe your changes here to communicate to the maintainers why you'd like to include this pull request.
4+
If it fixes a bug or resolves a feature request, be sure to link to that issue. -->
5+
6+
7+
<!-- You can erase any of the parts below that are not applicable to your Pull Request. -->
8+
9+
## Types of changes
10+
11+
<!-- Put an `x` in the boxes that apply -->
12+
13+
What types of changes does your code introduce?
14+
15+
- [ ] Bugfix (non-breaking change which fixes an issue)
16+
- [ ] New feature (non-breaking change which adds functionality)
17+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
18+
- [ ] Documentation fix or enhancement (no code was touched)
19+
- [ ] Other (CI, dependencies, etc., please describe)
20+
21+
22+
## Checklist:
23+
24+
- [ ] I have checked to ensure there aren't other open [Issues](../../../issues) or [Pull Requests](../../../pulls) for the same update/change
25+
- [ ] I have added tests that prove my fix is effective or that my feature works
26+
- [ ] I have added necessary documentation (if appropriate)
27+
- [ ] Any dependent changes have been merged and published in downstream modules
28+
- [ ] Static analysis and unit tests pass locally with my changes
29+
30+
31+
## Further comments
32+
33+
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

.github/workflows/ci.yml

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
2+
# https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml
3+
4+
# https://github.com/actions/checkout
5+
# https://github.com/actions/upload-artifact
6+
# https://github.com/shivammathur/setup-php
7+
# https://github.com/ramsey/composer-install
8+
# https://github.com/codecov/codecov-action
9+
# https://github.com/codacy/codacy-coverage-reporter-action
10+
# https://github.com/JamesIves/github-pages-deploy-action
11+
# https://github.com/stefanzweifel/git-auto-commit-action
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
pull_request:
18+
branches:
19+
- main
20+
21+
name: "Continuous Integration"
22+
23+
env:
24+
PHP_EXTENSIONS: none
25+
PHP_INI_VALUES: memory_limit=-1, error_reporting=-1, display_errors=On
26+
27+
jobs:
28+
29+
static-code-analysis:
30+
name: "Static Code Analysis"
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
fail-fast: true
35+
matrix:
36+
php-version:
37+
- "8.1"
38+
- "8.2"
39+
- "8.3"
40+
41+
env:
42+
PHAN_ALLOW_XDEBUG: 0
43+
PHAN_DISABLE_XDEBUG_WARN: 1
44+
45+
steps:
46+
- name: "Checkout"
47+
uses: actions/checkout@v4
48+
49+
- name: "Install PHP"
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php-version }}
53+
extensions: ast, ${{ env.PHP_EXTENSIONS }}
54+
ini-values: ${{ env.PHP_INI_VALUES }}
55+
coverage: none
56+
57+
- name: "Update dependencies with composer"
58+
uses: ramsey/composer-install@v3
59+
60+
- name: "Run phan"
61+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
62+
63+
64+
tests:
65+
name: "Unit Tests"
66+
needs: static-code-analysis
67+
runs-on: ${{ matrix.os }}
68+
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os:
73+
- ubuntu-latest
74+
- windows-latest
75+
php-version:
76+
- "8.1"
77+
- "8.2"
78+
- "8.3"
79+
80+
steps:
81+
- name: "Checkout"
82+
uses: actions/checkout@v4
83+
84+
- name: "Install PHP with extensions"
85+
uses: shivammathur/setup-php@v2
86+
with:
87+
php-version: ${{ matrix.php-version }}
88+
extensions: ${{ env.PHP_EXTENSIONS }}
89+
ini-values: ${{ env.PHP_INI_VALUES }}
90+
coverage: pcov
91+
92+
- name: "Install dependencies with composer"
93+
uses: ramsey/composer-install@v3
94+
95+
- name: "Run tests with phpunit"
96+
run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
97+
98+
- name: "Send code coverage report to Codecov.io"
99+
uses: codecov/codecov-action@v4
100+
with:
101+
token: ${{ secrets.CODECOV_TOKEN }}
102+
files: .build/coverage/clover.xml
103+
104+
- name: "Send code coverage report to Codacy"
105+
uses: codacy/codacy-coverage-reporter-action@v1
106+
with:
107+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
108+
coverage-reports: .build/coverage/clover.xml
109+
110+
111+
build-docs:
112+
name: "Build and publish API docs"
113+
if: github.ref_name == 'main'
114+
runs-on: ubuntu-latest
115+
116+
steps:
117+
- name: "Checkout sources"
118+
uses: actions/checkout@v4
119+
120+
- name: "Install PHP"
121+
uses: shivammathur/setup-php@v2
122+
with:
123+
php-version: "8.3"
124+
extensions: ${{ env.PHP_EXTENSIONS }}
125+
ini-values: ${{ env.PHP_INI_VALUES }}
126+
coverage: none
127+
tools: phpDocumentor
128+
129+
- name: "Build API docs"
130+
run: phpdoc --config=phpdoc.xml.dist
131+
132+
- name: "Publish API docs to branch gh-pages"
133+
uses: JamesIves/github-pages-deploy-action@v4
134+
with:
135+
branch: gh-pages
136+
folder: .build/phpdocs
137+
clean: true
138+
139+
140+
build-manual:
141+
name: "Build and publish user manual"
142+
if: github.ref_name == 'main'
143+
runs-on: ubuntu-latest
144+
145+
steps:
146+
- name: "Checkout sources"
147+
uses: actions/checkout@v4
148+
149+
- name: "Install Sphinx"
150+
run: pip install sphinx myst-parser sphinx-rtd-theme
151+
152+
- name: "Build manual"
153+
run: |
154+
cd docs
155+
make html
156+
157+
- name: "Publish user manual to branch readthedocs"
158+
uses: JamesIves/github-pages-deploy-action@v4
159+
with:
160+
branch: readthedocs
161+
folder: .build/sphinx/html
162+
clean: true

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# IDE - IntelliJ
2+
.idea/*
3+
# Keep the code styles.
4+
!.idea/codeStyles
5+
.idea/codeStyles/*
6+
!.idea/codeStyles/Project.xml
7+
!.idea/codeStyles/codeStyleConfig.xml
8+
# Keep the inspection levels
9+
!.idea/inspectionProfiles
10+
.idea/inspectionProfiles/*
11+
!.idea/inspectionProfiles/Project_Default.xml
12+
13+
# project stuff
14+
.build/*
15+
vendor/*
16+
composer.lock
17+
phpcs.xml
18+
phpdoc.xml
19+
phpmd.xml
20+
phpunit.xml

.idea/inspectionProfiles/Project_Default.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)