haspadar / php-skeleton
Reusable template for PHP libraries: Composer, CI, static analysis — all synced via one script
dev-main
2025-08-16 12:48 UTC
Requires
- php: 8.4.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- infection/infection: ^0.29.14
- nunomaduro/collision: ^8.8
- phpmetrics/phpmetrics: ^3.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.2
- rector/rector: ^2.1
- roave/security-advisories: dev-latest
- vimeo/psalm: ^6.10
This package is auto-updated.
Last update: 2025-08-16 12:48:19 UTC
README
ℹ️ About
Skeleton is a template for EO-style PHP libraries.
It provides a ready-to-use boilerplate with the same checks and structure
that will be reused across many future EO projects.
It comes with:
- consistent README header and footer sections;
- predefined CI pipeline (phpstan, psalm, rector, php-cs-fixer, infection, phpunit);
- examples of decomposition into small, final, immutable classes;
- sample I/O wrappers, tasks, and fakes for tests.
Usage
The entrypoint is bin/skeleton.php
.
It works in two modes:
- Copy-as-is – copies template files into your target directory.
- Section replacement – replaces README sections with your project-specific values.
Arguments:
--vendor=VendorName
--repo=repo-name
--namespace=MyNamespace
Defaults are guessed from your current Git repo.
php bin/skeleton.php --vendor=haspadar --repo=php-skeleton --namespace=PhpSkeleton
This will generate a README and boilerplate code with the provided values.
🧠 Philosophy
- ❌ No
null
,static
, or shared state in the public API - ✅ One object = one responsibility
- ✅ Final classes, immutability by default
- ✅ Composition over inheritance
- ✅ Behavior and data live together
Inspired by Elegant Objects and cactoos.
🧪 Quality & CI
Every push and pull request is checked via GitHub Actions:
- ✅ Static analysis with PHPStan (level 9) and Psalm (level 8)
- ✅ Type coverage report via Shepherd
- ✅ Code style check with PHP-CS-Fixer (only changed files)
- ✅ Unit tests with PHPUnit
- ✅ Code coverage via Codecov
- ✅ Mutation testing with Infection
- ✅ Composer validation, platform checks, security audit
- ✅ Automatic refactoring via Rector
📥 Installation
composer require haspadar/php-skeleton