| Install | |
|---|---|
composer require pekral/php-skeleton |
|
| Latest Version: | 0.3 |
| PHP: | ^8.4 |
Modern PHP package skeleton with strict quality rules and best practices baked in. Supports PHP 8.4 and 8.5.
Start your next PHP package with confidence. This skeleton comes pre-configured with industry-standard tools for static analysis, testing, and code quality — and includes an interactive installer that configures everything for you.
| Tool | Purpose |
|---|---|
| Pest | Elegant testing framework with 100% coverage requirement |
| PHPStan | Static analysis at maximum level |
| Laravel Pint | Opinionated PHP code style fixer |
| Rector | Automated code refactoring |
| PHP CodeSniffer | Coding standard enforcement |
| Security Advisories | Dependency vulnerability checking |
| Interactive Installer | Automatic project configuration |
composer create-project pekral/php-skeleton my-package
The interactive installer will guide you through the configuration process.
When you run composer create-project, an interactive installer automatically starts and helps you configure your new package.
Collects Project Information
{Namespace}Test)Optional: Project Specification
SPEC.md file (automatically added to .gitignore)Performs Automatic Configuration
composer.json with your package detailsREADME.md and CHANGELOG.md for your contentLICENSE with your informationphpstan.neon (removes build-package path)rector.php (removes build-package path)require-dev (except PHP)Creates Example Files
src/{ClassName}.php — Example class with greet() methodtests/Unit/{ClassName}Test.php — Pest test for the example classRuns Quality Pipeline
composer updatecomposer fix to apply code style fixescomposer check to verify all quality checks passOptional Features
pekral/cursor-rules ⚡ PHP Skeleton
Project Configuration
📝 Package Configuration
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Package name (vendor/package): acme/my-package
Root namespace [Acme\MyPackage]:
Test namespace [Acme\MyPackageTest]:
Display name [My Package]:
GitHub URL [https://github.com/acme/my-package]:
📋 Review Configuration
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
GitHub https://github.com/acme/my-package
Name My Package
Namespace Acme\MyPackage
Package acme/my-package
Tests Acme\MyPackageTest
Proceed? [yes]:
⚡ Processing Files
✓ Updated: composer.json
✓ Updated: README.md
✓ Created src/MyPackage.php
✓ Created tests/Unit/MyPackageTest.php
🚀 GitHub Actions
Install GitHub Actions? [yes]:
📋 Cursor Rules
Install cursor rules? [yes]:
📦 Git Repository
Initialize git? [yes]:
Default branch [main]:
✓ Initialized with initial commit
✓ Done!
Your project is ready.
If you press Ctrl+C during installation, the installer will:
composer check
This runs the complete quality pipeline:
composer fix
Automatically fixes code style and applies refactoring:
| Command | Description |
|---|---|
composer test:coverage |
Run tests with coverage (min 100%) |
composer analyse |
Run PHPStan static analysis |
composer pint-check |
Check code style |
composer pint-fix |
Fix code style |
composer rector-check |
Check for refactoring opportunities |
composer rector-fix |
Apply automated refactoring |
composer phpcs-check |
Check coding standards |
composer phpcs-fix |
Fix coding standard violations |
composer composer-validate |
Validate composer.json schema |
composer composer-normalize-check |
Check composer.json normalization |
composer composer-normalize-fix |
Normalize composer.json |
composer security-audit |
Check for vulnerable dependencies |
After installation, your project will have:
my-package/
├── .github/
│ ├── dependabot.yml # Dependabot (Composer + GitHub Actions)
│ └── workflows/
│ ├── checkers.yml # Quality checks and security scanning
│ ├── release.yml # Release automation
│ ├── stale.yml # Stale issue management
│ └── update-changelog.yml # Changelog automation
├── docs/ # Documentation folder
├── src/
│ └── MyPackage.php # Example class (your namespace)
├── tests/
│ └── Unit/
│ └── MyPackageTest.php # Example Pest test
├── .gitignore # Git ignore rules
├── composer.json # Dependencies and scripts
├── phpstan.neon # PHPStan configuration (level max)
├── phpunit.xml # PHPUnit/Pest configuration
├── pint.json # Laravel Pint rules
├── rector.php # Rector configuration
├── ruleset.xml # PHP CodeSniffer rules
├── CHANGELOG.md # Version history (empty)
├── README.md # Project readme (empty)
└── LICENSE # MIT License
Static analysis runs at maximum level with additional rules:
# phpstan.neon
parameters:
level: max
treatPhpDocTypesAsCertain: false
Tests use Pest v4 with strict coverage requirements:
# Runs with 100% minimum coverage using PCOV
composer test:coverage
Laravel Pint enforces PSR-12 with additional rules for clean, consistent code.
Automated refactoring uses rules from pekral/rector-rules package.
The skeleton includes comprehensive CI/CD workflows:
| Workflow | Purpose |
|---|---|
checkers.yml |
Quality checks and security scanning on PRs, pushes to master, and weekly schedule |
| Dependabot | Automated dependency updates (Composer + GitHub Actions) |
release.yml |
Release automation |
stale.yml |
Marks and closes stale issues/PRs |
update-changelog.yml |
Automated changelog updates |
All workflows run on PHP 8.4 and 8.5 (matrix).
Contributions are welcome! Please read our Contributing Guide before submitting a Pull Request.
This package is open-sourced software licensed under the MIT license.
Petr Král
Built with care for the PHP community