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

This package is auto-updated.

Last update: 2025-08-16 12:48:19 UTC


README

PHP Version Code Style Psalm

ℹ️ 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:

  1. Copy-as-is – copies template files into your target directory.
  2. 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

Skeleton CLI Demo

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

Requires PHP 8.4

📄 License

MIT