Package info
gitlab.com/php-standard-library/release-packages/sdk
Type:standard-library-sdk
pkg:composer/standard-library/sdk
Requires
- php: ^8.5.0
- exception/unexpected: ^1.0.0
- friendsofphp/php-cs-fixer: ^v3.95.4
- phpstan/extension-installer: ^1.4.2
- phpstan/phpstan: ^2.2.3
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^13.2.2
- rector/rector: ^2.4.3
- symfony/console: ^v8.0.4
- symfony/filesystem: ^v8.0.4
- symfony/process: ^v8.0.4
- symfony/yaml: ^v8.0.4
README
Shared dev tooling for PHP Standard Library packages: linting, static analysis and testing.
require it as a dev dependency and it exposes a set of commands under your project's bin/
directory (composer's bin-dir).
{
"require-dev": {
"standard-library/sdk": "^1.0"
}
}
Commands
| Command | Purpose |
|---|---|
bin/composer-update | Run composer update inside the skpr/php-cli:8.5-v2-stable Docker image, mounting the current directory as /opt/project. |
bin/sdk | Symfony Console application entry point; runs directly on the host (no Docker). |
bin/sdk commands
bin/sdk auto-registers commands from every installed composer package of type
"standard-library-sdk" (sdk, sdk-application, sdk-framework, or any third-party package
using the same type) that ships a config.yaml at its package root:
commands:
- App\Console\SomeCommand
Each listed class must extend StandardLibrary\Sdk\Console\Command. sdk itself contributes:
| Command | Purpose |
|---|---|
bin/sdk info | Prints the text configured under its own FQN section in config-dev.yaml. |
bin/sdk fix | Apply PHP-CS-Fixer fixes. |
bin/sdk run:style | Check code style with PHP-CS-Fixer (--dry-run). |
bin/sdk run:stan | Run PHPStan (level max), including the custom rules. |
bin/sdk run:tests | Run the PHPUnit test suite. |
Don't confuse this package-root config.yaml (which commands a package provides) with
config-dev.yaml in the consumer project root (the runtime configuration those commands read).
StandardLibrary\Sdk\Build\
Small, reusable pieces shared by build-flavoured standard-library-sdk packages
(standard-library/sdk-application's directory build, standard-library/sdk-phar's PHAR build):
BuildLogger/ConsoleBuildLogger (a one-method logging interface plus a STDOUT-writing default
implementation), ProjectCopier (copies the project into a build directory via git clone, or
git archive piped into tar when only specific dirs/files are selected, so uncommitted or
gitignored files never leak into a build), and ComposerInstaller (composer install --no-dev
--no-interaction in the build directory). They live here rather than in either build package so
neither has to depend on the other just to reuse them.
Every bin/sdk command additionally accepts a global -d/--docker[=IMAGE] option. When given,
bin/sdk re-runs itself inside a Docker container instead of on the host — mounting the current
directory as /opt/project and running the same command (minus -d/--docker itself) there.
IMAGE defaults to skpr/php-cli:8.5-v2-stable if omitted (-d/--docker with no value), e.g.
bin/sdk info --docker or bin/sdk info --docker=my/other-image:tag.
Shell completion
bin/sdk gets shell tab-completion for free from Symfony Console's built-in completion command:
bin/sdk completion zsh > ~/.zfunc/_sdk # once, assuming ~/.zfunc is on fpath
# or:
echo 'eval "$(bin/sdk completion zsh)"' >> ~/.zshrc
(bash/fish work the same way via bin/sdk completion bash/fish.) This covers command names and
options out of the box. Commands whose argument values come from config-dev.yaml (e.g. deploy
<environment>) additionally suggest those via Command::suggestConfigKeys() — a closure passed as
addArgument()'s $suggestedValues, returning the top-level keys of that command's own FQN section.