laminas / internal-tooling
Internal tooling configuration and defaults for Laminas and Mezzio projects
Fund package maintenance!
crowdfunding.linuxfoundation.org/initiatives/laminas-project
Requires
- php: ~8.2 || ~8.3 || ~8.4 || ~8.5 || ~8.6
- carthage-software/mago: ^1.51.2
- composer/semver: ^3.5
- php-collective/toml: ^0.1.5
- symfony/yaml: ^7.4 || ^8.1
Requires (Dev)
- phpunit/phpunit: ^11.5.57 || ^12.5.38 || ^13.4.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-08 16:57:24 UTC
README
This is a dev dependency for PHP repositories in the Laminas and Mezzio ecosystems.
It is not intended for external use.
Install
composer require laminas/internal-tooling
Next, copy the shipped Makefile template to the root of the project with:
cp vendor/laminas/internal-tooling/templates/MakefileTemplate.mk ./Makefile
The template will need some adjustment depending on the project.
Requirements
Pretty much everything runs in Docker, so you will need docker installed and running on the host machine for the make targets to work.
Other host machine dependencies include:
xpathSome targets shell out toxpathto inspect XML configuration filesfindUsed in some situations to discover files in the working treegitUsed to fetch the documentation theme when building docs
Features
Out-of-the-box Makefile
After copying the shipped Makefile template, it will need a few minor adjustments.
These are documented in the template.
Now, running make should list a number of useful targets for general QA work on Laminas and Mezzio libraries.
Most tools that perform QA checks that can be detected as being installed are added to the qa target, so issuing make qa will run everything in series.
Markdown Linting
With the provided Makefile, running make docs-lint will check all Markdown files in the root directory, and in the ./docs subdirectory against the markdownlint rules used in CI.
This target is also appended to the qa make target.
Markdown Link Checker
When a ./docs directory exists, make qa will automatically invoke the target docs-check-links, which will in turn run a link checker over all the Markdown files in ./docs
Documentation Builder
The docs-build target will fetch the documentation theme repository, build a mkdocs image and build the static docs directory as per Laminas conventions so that you can eyeball the built docs locally before pushing.
Mago Configuration
Provides a default configuration for Mago which projects should extend for consistent coding standards via mago fmt and sane defaults for static analysis.
To make use of Mago, create a mago.toml in the root directory that extends the configuration shipped here:
#:schema https://mago.carthage.software/1.51.0/schema.json extends = "vendor/laminas/internal-tooling/mago/defaults.toml" # ... customised per-project rules and configuration follows
There are a number of make targets available for running Mago's suite of tools.
make qa will run the formatter in check mode, the linter and the analyser.
PHP Code Sniffer Make Targets
make phpcsRuns PHP_CodeSniffer coding standards checksmake phpcbfRuns PHP_CodeSniffer's fixers
Psalm Make Targets
make psalmRun Psalm SA checksmake psalm-update-baselineUpdate the Psalm baselinemake psalm-set-baselineExpand the Psalm baseline with new issuesmake psalm-clear-cacheClears the Psalm cache
PHPUnit Make Targets
make test
Rector Targets
When rector is installed to ./tools/rector
make rector(Run rector with --dry-run)make rector-fix
Infection Targets
When infection is installed to ./tools/infection
make infection
StructArmed Targets
When StructArmed is installed to ./tools/structarmed
make structarmedRuns the analysismake structarmed-fixRuns auto fixersmake structarmed-clearClears the cache
Dependency Management Targets
make install- Often not required because this lib is distributed via composer itselfmake update- Runs composer update with the project docker imagemake bump-dev- Bumps development dependenciesmake outdated- Runcomposer outdated
For tools that are installed in subdirectories, it's a pain to cd to each one and run composer for each tool, therefore these targets operate on all installed tools:
make install-toolsmake update-toolsmake bump-tools
Migrations
Migrations represent small units of automation for common or one-off maintenance tasks for Laminas Repos.
PHP 8.6 Migration
make migrate-to-php86
For more information about this migration see the README.
Install Mago
make install-mago
This adds mago as a direct dependency of the project, initialises a sensible default configuration and empty baselines. Also adds these files to export ignores.
The target is only available if ./mago.toml does not already exist.
Rector Installation
Install rector into ./tools/rector
make install-rector
Infection Installation
Install infection into ./tools/infection
make install-infection
By default, the Min MSI is not configured, so tweaking the configuration file may be necessary.
Additionally, depending on what version of PHPUnit is installed, some settings may need adjusting for PHPUnit such as executionOrder
StructArmed Installation
Install StructArmed into ./tools/structarmed
make install-structarmed
Once installed, further configuration will be required.
Psalm Removal
Psalm can be removed from the project with make uninstall-psalm if Psalm is installed.