Starter template for PHP 8.5 packages that use standalone shared CLI tooling from php-tools.
This repository gives you a modern PHP 8.5 package template with a shared php-tools toolchain, configurable suite commands, sample Spartan and Pest tests, static analysis, refactoring, formatting, documentation generation, and optional GitHub CI scaffolding ✨
You can turn individual tools on or off in config/tools.conf, so each project can keep the same friendly workflow while enabling only the parts it actually wants to use ⚙️
The suite is designed to run independent tools in parallel whenever possible, so validation stays fast without dropping checks 🚀
composer create-project parf/composer-php85-template your-project-name
cd your-project-nameInstall php-tools.
- run
composer dryto inspect non-mutating tool results - run
composer testto run enabled tests - run
composer fixif you want to apply automated changes - run
composer checkfor the full validation pass before commit or push - run
composer docwhen you want to generate documentation
Helper commands:
./check-commit [commit-message]- runs
composer check - if check succeeds, shows the files that would be added/committed
- asks for a commit message if one was not passed on the command line
- if the message is left empty, exits with
1, creates no commit, and adds no new files to git - stages all changes, then creates the commit
- runs
./check-push [commit-message] [branch]- runs
./check-commit - pushes after a successful check and commit
- optional second argument: target branch
- runs
./psyshstarts the interactive PHP shell
If a required tool fails during composer check, then ./check-commit and ./check-push stop immediately and no commit or push is performed.
Need the full command list? See COMMANDS.md 📘
The suite commands read config/tools.conf.
Use this file to choose which tools are active in your project. If you do not want to use a tool, set its flag to 0. That way you keep the same shared command surface while tailoring the template to the stack you actually want ⚙️
This template keeps CLI tools in a shared php-tools install instead of require-dev, so project dependencies stay small and the same toolchain can be reused across projects 🔧
Included tools: PHP lint, Mago, Psalm, PHPStan, Rector, phpDocumentor, php-cs-fixer, spartan-test, Pest, PsySH.
If one of these commands is not on PATH, the suite scripts fail fast and point to the setup guide.
The template includes optional GitHub repository scaffolding:
- Actions workflows for linting and tests
- Dependabot configuration
renovate.json.distas an optional Renovate starter config- issue templates for bug reports and questions
These files are adapted for the standalone php-tools workflow and do not require Docker 🐳
GitHub Actions workflows are provided in:
.github/workflows/lint.yml.github/workflows/tests.yml
They run automatically on push and pull_request.
Workflow coverage:
Lint: installsphp-tools, then runscomposer dryTests: installsphp-tools, installsGNU parallel, then runscomposer test
Local equivalents:
Lintis equivalent tocomposer dryTestsis equivalent tocomposer test
If you do not want GitHub CI in your derived project, just remove the .github/workflows/ files.
src/TemplatePackage/contains a sampleHelloWorldsclasstests/Test.stestis the starter Spartan testtests/Pest.phpandtests/Pest/HelloWorldsTest.phpare the starter Pest testsscripts/test-suite.shruns the enabled test runners forcomposer testtests/fixtures-src/is reserved for test-only sample source files if the package grows
If your test suite grows, group tests by topic under tests/ instead of keeping everything in one file. That keeps the starter layout simple while leaving room to grow 🌱
See ANALYZER-HOWTO.md for quick Psalm and PHPStan notes.