Skip to content

Commit 8d9a37c

Browse files
authored
Initial commit
0 parents  commit 8d9a37c

22 files changed

Lines changed: 1009 additions & 0 deletions

.editorconfig

Lines changed: 16 additions & 0 deletions
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

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

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: codemasher
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
2+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
3+
4+
name: "Bug report"
5+
description: "You've found a bug? Does the library not behave as expected?"
6+
title: "[BUG] "
7+
labels: ["bug"]
8+
9+
body:
10+
11+
- type: markdown
12+
attributes:
13+
value: "You've found a bug? Does the library not behave as expected?\nPlease help us to improve this project and fill out the following form.\nIf you are unsure whether it is a bug, or you have a question or an issue that is not a bug, please go to [the discussions section](../discussions) instead. Thanks!"
14+
15+
- type: textarea
16+
validations:
17+
required: true
18+
attributes:
19+
label: "Issue description"
20+
description: "Please describe the bug or unexpected behaviour, add screenshots to help explain the problem if applicable."
21+
placeholder: "A clear and concise description of the issue"
22+
23+
- type: textarea
24+
validations:
25+
required: true
26+
attributes:
27+
label: "Expected behavior"
28+
description: "Please describe what you expected to happen or how the library should behave in this case."
29+
placeholder: "A clear and concise description of what you expected to happen"
30+
31+
- type: textarea
32+
validations:
33+
required: false
34+
attributes:
35+
label: "Code sample"
36+
description: "If applicable, please add a code sample that reproduces the issue.\nNote: the content of this textarea will be rendered as PHP code!"
37+
placeholder: "PHP code"
38+
render: php
39+
40+
- type: dropdown
41+
id: version
42+
validations:
43+
required: true
44+
attributes:
45+
label: "Library version"
46+
description: "What version of the library are you running?"
47+
options:
48+
- "latest"
49+
- "dev-main"
50+
- "1.x"
51+
default: 0
52+
53+
- type: textarea
54+
validations:
55+
required: false
56+
attributes:
57+
label: "Additional context"
58+
description: "Add any other context that might be of use here, e.g. exact library version, PHP Version, operating system, other code snippets..."
59+
60+
- type: markdown
61+
attributes:
62+
value: "Thanks for taking the time to fill out this issue report!"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
2+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
3+
4+
name: "Feature request"
5+
description: "You have an idea for a new feature?"
6+
title: "[ENHANCEMENT] "
7+
labels: ["enhancement"]
8+
9+
body:
10+
11+
- type: markdown
12+
attributes:
13+
value: "You have an idea for a new feature (or improve an existing one)? Great!\nPlease help us to improve this project and fill out the following form.\nIf you have a question or an issue that is not a feature request, please go to [the discussions section](../discussions) instead. Thanks!"
14+
15+
- type: textarea
16+
validations:
17+
required: true
18+
attributes:
19+
label: "Feature description"
20+
description: "Please describe the requested feature."
21+
placeholder: "A clear and concise description of the requested feature"
22+
23+
- type: textarea
24+
validations:
25+
required: false
26+
attributes:
27+
label: "Code sample"
28+
description: "If applicable, please add a code sample to illustrate the feature.\nNote: the content of this textarea will be rendered as PHP code!"
29+
placeholder: "PHP code"
30+
render: php
31+
32+
- type: textarea
33+
validations:
34+
required: false
35+
attributes:
36+
label: "Additional context"
37+
description: "Add any other context that might be of use here, e.g. other code snippets..."
38+
39+
- type: dropdown
40+
validations:
41+
required: true
42+
id: pr
43+
attributes:
44+
label: "Pull Request"
45+
description: "**Are you (the requester) willing to submit a pull request for that feature?**\nA yes will greatly increase the chance that the feature will be added."
46+
options:
47+
- ""
48+
- "No - I can't/won't submit a PR"
49+
- "Yes - I will submit a PR"
50+
51+
- type: markdown
52+
attributes:
53+
value: "Thanks for taking the time to fill out this feature request!"

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 33 additions & 0 deletions
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

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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: "" # caution: setting 'none' resets/disables shared extensions
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+
env:
34+
PHAN_ALLOW_XDEBUG: 0
35+
PHAN_DISABLE_XDEBUG_WARN: 1
36+
37+
strategy:
38+
fail-fast: true
39+
matrix:
40+
php-version:
41+
- "8.1"
42+
- "8.2"
43+
- "8.3"
44+
- "8.4"
45+
46+
steps:
47+
- name: "Checkout"
48+
uses: actions/checkout@v4
49+
50+
- name: "Install PHP"
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.php-version }}
54+
extensions: ast, ${{ env.PHP_EXTENSIONS }}
55+
ini-values: ${{ env.PHP_INI_VALUES }}
56+
coverage: none
57+
58+
- name: "Validate composer.json"
59+
run: composer validate --ansi --strict
60+
61+
- name: "Install dependencies with composer"
62+
uses: ramsey/composer-install@v3
63+
64+
- name: "Run PHP_CodeSniffer"
65+
run: php vendor/bin/phpcs -v
66+
67+
- name: "Run phan"
68+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
69+
70+
- name: "Run PHPStan"
71+
run: php vendor/bin/phpstan
72+
73+
74+
tests:
75+
name: "Unit Tests"
76+
needs: static-code-analysis
77+
runs-on: ${{ matrix.os }}
78+
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
os:
83+
- ubuntu-latest
84+
- windows-latest
85+
php-version:
86+
- "8.1"
87+
- "8.2"
88+
- "8.3"
89+
- "8.4"
90+
91+
steps:
92+
- name: "Checkout"
93+
uses: actions/checkout@v4
94+
95+
- name: "Install PHP with extensions"
96+
uses: shivammathur/setup-php@v2
97+
with:
98+
php-version: ${{ matrix.php-version }}
99+
extensions: ${{ env.PHP_EXTENSIONS }}
100+
ini-values: ${{ env.PHP_INI_VALUES }}
101+
coverage: pcov
102+
103+
- name: "Install dependencies with composer"
104+
uses: ramsey/composer-install@v3
105+
106+
- name: "Run tests with phpunit"
107+
run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
108+
109+
# - name: "Send code coverage report to Codecov.io"
110+
# uses: codecov/codecov-action@v5
111+
# with:
112+
# token: ${{ secrets.CODECOV_TOKEN }}
113+
# files: .build/coverage/clover.xml
114+
115+
# - name: "Send code coverage report to Codacy"
116+
# uses: codacy/codacy-coverage-reporter-action@v1
117+
# with:
118+
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
119+
# coverage-reports: .build/coverage/clover.xml
120+

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
21+
phpstan.neon

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)