Skip to main content
The setup-php action has been tested with a wide range of PHP frameworks and packages. This page collects the official example workflows so you can copy a starting point that matches your stack. All examples follow the same pattern:
  • Check out your code with actions/checkout
  • Set up PHP with shivammathur/setup-php@v2
  • Cache Composer dependencies with actions/cache
  • Install dependencies and run your test suite
For the full set of workflow files, see the examples/ directory on GitHub.

Available examples

Workflow examples

The sections below show representative workflows you can use as a starting point. Each example includes Composer caching, which speeds up repeated runs by reusing previously downloaded packages.
Tests a Laravel application on Ubuntu, Windows, and macOS across multiple PHP versions. Uses Xdebug for coverage.
Tests a Laravel application with MySQL and Redis service containers. The service ports are mapped dynamically and passed to the application via environment variables.
Tests a Symfony application on all three operating systems. Installs the common Symfony extensions and runs PHPUnit with coverage.
Demonstrates a multi-job workflow for CakePHP: one job for tests using PCOV coverage, a second for PHP CodeSniffer, and a third for PHPStan static analysis.
Tests a WordPress plugin using the official wp scaffold plugin-tests scaffolding. Requires a MySQL service container and the WordPress test environment install script.
The complete set of example workflows, including database variants (MySQL, PostgreSQL) and additional frameworks, is available in the examples/ directory of the setup-php repository.