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
examples/ directory on GitHub.
Available examples
| Framework / Package | Runs on | Workflow file |
|---|---|---|
| Blackfire | macOS, Ubuntu, Windows | blackfire.yml |
| Blackfire Player | macOS, Ubuntu | blackfire-player.yml |
| CakePHP with MySQL and Redis | Ubuntu | cakephp-mysql.yml |
| CakePHP with PostgreSQL and Redis | Ubuntu | cakephp-postgres.yml |
| CakePHP without services | macOS, Ubuntu, Windows | cakephp.yml |
| CodeIgniter | macOS, Ubuntu, Windows | codeigniter.yml |
| Drupal 11 (Composer-managed) | Ubuntu | drupal.yml |
| Laminas MVC | macOS, Ubuntu, Windows | laminas-mvc.yml |
| Laravel with MySQL and Redis | Ubuntu | laravel-mysql.yml |
| Laravel with PostgreSQL and Redis | Ubuntu | laravel-postgres.yml |
| Laravel without services | macOS, Ubuntu, Windows | laravel.yml |
| Lumen with MySQL and Redis | Ubuntu | lumen-mysql.yml |
| Lumen with PostgreSQL and Redis | Ubuntu | lumen-postgres.yml |
| Lumen without services | macOS, Ubuntu, Windows | lumen.yml |
| Phalcon with MySQL | Ubuntu | phalcon-mysql.yml |
| Phalcon with PostgreSQL | Ubuntu | phalcon-postgres.yml |
| Slim Framework | macOS, Ubuntu, Windows | slim-framework.yml |
| Symfony with MySQL | Ubuntu | symfony-mysql.yml |
| Symfony with PostgreSQL | Ubuntu | symfony-postgres.yml |
| Symfony without services | macOS, Ubuntu, Windows | symfony.yml |
| WordPress plugin | Ubuntu | wordpress.yml |
| WordPress with Roots/Bedrock | Ubuntu | bedrock.yml |
| WordPress with Roots/Sage | Ubuntu | sage.yml |
| Yii3 with MySQL | Ubuntu | yii3-mysql.yml |
| Yii3 with PostgreSQL | Ubuntu | yii3-postgres.yml |
| Yii3 web application | Ubuntu, Windows | yii3.yml |
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.Laravel (cross-platform, no services)
Laravel (cross-platform, no services)
Tests a Laravel application on Ubuntu, Windows, and macOS across multiple PHP versions. Uses Xdebug for coverage.
Laravel with MySQL and Redis (Ubuntu)
Laravel with MySQL and Redis (Ubuntu)
Tests a Laravel application with MySQL and Redis service containers. The service ports are mapped dynamically and passed to the application via environment variables.
Symfony (cross-platform, no services)
Symfony (cross-platform, no services)
Tests a Symfony application on all three operating systems. Installs the common Symfony extensions and runs PHPUnit with coverage.
CakePHP (tests, coding standard, and static analysis)
CakePHP (tests, coding standard, and static analysis)
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.
WordPress plugin (Ubuntu with MySQL)
WordPress plugin (Ubuntu with MySQL)
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.