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

0.1.3 2026-01-11 15:22 UTC

This package is auto-updated.

Last update: 2026-01-11 19:20:44 UTC


README

PHP Version License PHPStan Pest Code Coverage

๐Ÿš€ 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

  1. Collects Project Information

    • Package name (vendor/package format)
    • Root PSR-4 namespace
    • Test namespace
    • Display name
    • GitHub repository URL
  2. Optional: Project Specification

    • Paste multi-line project specification text
    • Creates SPEC.md file (automatically added to .gitignore)
  3. Performs Automatic Configuration

    • Updates composer.json with your package details
    • Replaces namespaces across all files
    • Updates README.md and LICENSE
    • Cleans up phpstan.neon and rector.php
    • Moves dev dependencies to require-dev
    • Creates example class and test
  4. Creates Example Files

    • src/{ClassName}.php โ€” Example class with greet() method
    • tests/Unit/{ClassName}Test.php โ€” Pest test for the example class
  5. 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

Built with โค๏ธ for the PHP community