Skip to content

Repository files navigation

PHP Forge

PHPForge - Reusable GitHub Actions


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.

Features

Feature Overview

Available Workflows

Testing Workflows

Quality Assurance Workflows

Utility Actions

Quick start

Composer Require Checker

---
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"

Easy Coding Standard

---
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"]'

Infection Mutation Testing {#infection}

---
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

PHPUnit

---
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

PHPUnit with Database

---
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: mysql

Supported Databases:

DatabaseDocker ImageDefault PortHealth Check Command
MySQLmysql3306mysqladmin ping
PostgreSQLpostgres5432pg_isready
SQL Servermcr.microsoft.com/mssql/server1433sqlcmd -Q "SELECT 1"
Oraclegvenzl/oracle-xe1521sqlplus -S / as sysdba

PHPStan Static Analysis

---
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

Linter

---
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

Security

---
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.yml

Note: YAML files should use 2-space indentation. This example shows correct YAML syntax - copy it to your .github/workflows/*.yml files as-is.

Package information

GitHub Release

Quality code

Quality

Our social networks

Follow on X

License

License

About

Actions reusables.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors