pekral / php-skeleton
Modern PHP package skeleton with strict quality rules, PHPStan max level, Pest testing, and best practices baked in
Fund package maintenance!
pekral
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/pekral/php-skeleton
Requires
- php: ^8.4
- ergebnis/composer-normalize: ^2.48.2
- laravel/pint: ^1.27.0
- nunomaduro/termwind: ^2.3
- pekral/cursor-rules: dev-master
- pekral/phpcs-rules: dev-master
- pekral/rector-rules: dev-master
- pestphp/pest: ^4.3.1
- pestphp/pest-plugin-type-coverage: ^4.0.3
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1.33
- phpstan/phpstan-deprecation-rules: ^2.0.3
- phpstan/phpstan-mockery: ^2.0
- phpstan/phpstan-phpunit: ^2.0.11
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: >=4.0.1
- symfony/console: ^7.4.3
This package is auto-updated.
Last update: 2026-01-11 19:20:44 UTC
README
๐ Modern PHP package skeleton with strict quality rules and best practices baked in.
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.
โจ Features
| 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 |
๐ฆ Installation
composer create-project pekral/php-skeleton my-package
The interactive installer will guide you through the configuration process.
๐ Interactive Installer
When you run composer create-project, an interactive installer automatically starts and helps you configure your new package.
What the Installer Does
-
Collects Project Information
- Package name (vendor/package format)
- Root PSR-4 namespace
- Test namespace
- Display name
- GitHub repository URL
-
Optional: Project Specification
- Paste multi-line project specification text
- Creates
SPEC.mdfile (automatically added to.gitignore)
-
Performs Automatic Configuration
- Updates
composer.jsonwith your package details - Replaces namespaces across all files
- Updates
README.mdandLICENSE - Cleans up
phpstan.neonandrector.php - Moves dev dependencies to
require-dev - Creates example class and test
- Updates
-
Creates Example Files
src/{ClassName}.phpโ Example class withgreet()methodtests/Unit/{ClassName}Test.phpโ Pest test for the example class
-
Optional Features
- GitHub Actions โ Keep or remove CI/CD workflows
- Cursor Rules โ Install AI coding assistant rules
- Git Repository โ Initialize with custom branch name
- Push to Remote โ Force push initial commit to GitHub
Installer Flow Example
โก 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 repository? [yes]:
Branch name [main]:
โ Git repository initialized
โ Initial commit created
โ Project configured successfully!
Cancellation & Cleanup
If you press Ctrl+C during installation, the installer will:
- Display a cancellation message
- Automatically delete the partially created project directory
- Exit cleanly
๐ฏ Available Commands
Run All Quality Checks
composer check
This runs the complete quality pipeline:
- Composer normalize
- PHP CodeSniffer
- Laravel Pint
- Rector
- PHPStan
- Security audit
- Tests with 100% coverage
Apply All Fixes
composer fix
Automatically fixes code style and applies refactoring.
Individual Commands
| 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-normalize-check |
Check composer.json normalization |
composer composer-normalize-fix |
Normalize composer.json |
composer security-audit |
Check for vulnerable dependencies |
๐ Project Structure
After installation, your project will have:
my-package/
โโโ .github/
โ โโโ workflows/
โ โโโ pr.yml # GitHub Actions CI workflow
โโโ 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
๐ง Configuration
PHPStan
Static analysis runs at maximum level with additional rules:
- Deprecation rules
- Mockery extension
- PHPUnit extension
# phpstan.neon parameters: level: max
Testing
Tests use Pest with strict coverage requirements:
# Runs with 100% minimum coverage
composer test:coverage
Code Style
Laravel Pint enforces PSR-12 with additional rules for clean, consistent code.
๐ Requirements
- PHP 8.4 or higher
- Composer 2.x
๐ค Contributing
Contributions are welcome! Please read our Contributing Guide before submitting a Pull Request.
๐ License
This package is open-sourced software licensed under the MIT license.
๐ค Author
Petr Krรกl
- GitHub: @pekral
- Email: kral.petr.88@gmail.com
- X (Twitter): https://x.com/kral_petr_88
Built with โค๏ธ for the PHP community