A comprehensive collection of reusable GitHub Actions and workflows specifically designed for PHP projects. Streamline your CI/CD pipeline with battle-tested, configurable workflows for testing, static analysis, and code quality checks.
codeception.yml- Codeception testing framework.infection.yml- Mutation testing with Infection.phpunit-database.yml- PHPUnit with database services.phpunit.yml- PHPUnit testing with coverage.
composer-require-checker.yml- Dependency validation.ecs.yml- Easy Coding Standard.phpstan.yml- Static analysis.quality.yml- Reusable quality checks.security.yml- Security checks for GitHub Actions and secrets.
actionlint- GitHub Actions workflow linting.codespell- Spelling validation.editorconfig-checker- EditorConfig validation.markdownlint- Markdown validation.php-setup- PHP environment setup.phpunit-runner- Advanced PHPUnit execution.prettier- Markdown and YAML formatting validation.yamllint- YAML validation.
---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: composer-require-checkerjobs:
dependency-check:
uses: php-forge/actions/.github/workflows/composer-require-checker.yml@v1with:
command-options: "--config-file=.composer-require-checker.json"---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: easy-coding-standardsjobs:
coding-standards:
uses: php-forge/actions/.github/workflows/ecs.yml@v1with:
command-options: "check --ansi --no-progress-bar"php-version: '["8.4"]'---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: mutation-testingjobs:
mutation-testing:
uses: php-forge/actions/.github/workflows/infection.yml@v2secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}with:
# Infection configurationcommand-options: "--threads=4 --min-msi=80"command-coverage-options: --with-uncovered# PHPStan integrationphpstan: true---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: buildjobs:
phpunit:
uses: php-forge/actions/.github/workflows/phpunit.yml@v1secrets:
AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}with:
# Composer settingscomposer-command: composer install --prefer-dist --no-progress# Coverage settingscoverage-driver: pcovcoverage-format: clover# PHP configurationextensions: mbstring, intl, pdo_sqliteini-values: date.timezone='UTC', memory_limit=-1# Operating systemsos: '["ubuntu-latest", "windows-2022"]'# PHP versions to testphp-version: '["8.1", "8.2", "8.3", "8.4"]'# PHPUnit configurationphpunit-configuration: phpunit.xmlphpunit-exclude-group: integrationphpunit-group: unit---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: build-mysqljobs:
database-tests:
uses: php-forge/actions/.github/workflows/phpunit-database.yml@v1secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}with:
# Database configurationdatabase-env: | { "MYSQL_ROOT_PASSWORD": "root", "MYSQL_DATABASE": "test" } database-health-cmd: "mysqladmin ping" database-health-retries: 3 database-image: mysql database-port: 3306 database-type: mysql database-versions: '["8.0", "8.4", "latest"]' extensions: pdo, pdo_mysql php-version: '["8.4"]' phpunit-group: mysqlSupported Databases:
| Database | Docker Image | Default Port | Health Check Command |
|---|---|---|---|
| MySQL | mysql | 3306 | mysqladmin ping |
| PostgreSQL | postgres | 5432 | pg_isready |
| SQL Server | mcr.microsoft.com/mssql/server | 1433 | sqlcmd -Q "SELECT 1" |
| Oracle | gvenzl/oracle-xe | 1521 | sqlplus -S / as sysdba |
---
on:
pull_request: &ignore-pathspaths-ignore:
- ".gitattributes"
- ".gitignore"
- "CHANGELOG.md"
- "docs/**"
- "README.md"push: *ignore-pathsname: static-analysisjobs:
static-analysis:
uses: php-forge/actions/.github/workflows/phpstan.yml@v1with:
# PHPStan configurationconfiguration: phpstan.neoncommand-options: "analyse --error-format=checkstyle | cs2pr"# Environmentphp-version: '["8.4"]'tools: cs2pr---
on:
- pull_request
- pushname: linterjobs:
linter:
uses: php-forge/actions/.github/workflows/quality.yml@mainpermissions:
contents: read# Optional configuration and ignore paths, including former .github/linters files.# with:# actionlint-config: .github/linters/actionlint.yml# codespell-config: .github/linters/.codespellrc# codespell-ignore-words-file: .github/linters/codespell-ignored-words.txt# editorconfig-checker-config: .github/linters/.editorconfig-checker.json# markdownlint-config: .github/linters/.markdown-lint.yml# prettier-config: .github/linters/.prettierrc# prettier-ignore-path: .github/linters/.prettierignore# yamllint-config: .github/linters/.yaml-lint.yml---
on:
- pull_request
- pushname: securitypermissions:
contents: readjobs:
security:
uses: php-forge/actions/.github/workflows/security.yml@mainpermissions:
contents: read# Optional configuration and ignore paths, including former .github/linters files.# with:# gitleaks-config: .github/linters/.gitleaks.toml# zizmor-config: .github/linters/zizmor.ymlNote: YAML files should use 2-space indentation. This example shows correct YAML syntax - copy it to your
.github/workflows/*.ymlfiles as-is.