PHPackages                             tomkyle/boilerplate-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tomkyle/boilerplate-php

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tomkyle/boilerplate-php
=======================

PHP package boilerplate. Automatically runs PHPUnit, PHPStan, Rector, and PHP-CS-Fixer on file changes.

1.3.2(1y ago)019MITPHPPHP ^8.3CI passing

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tomkyle/boilerplate-php)[ Packagist](https://packagist.org/packages/tomkyle/boilerplate-php)[ RSS](/packages/tomkyle-boilerplate-php/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (12)Versions (13)Used By (0)

PHP Package Boilerplate
=======================

[](#php-package-boilerplate)

[![Composer Version](https://camo.githubusercontent.com/2f6986e31e180c1c9f68ad0a38ffb782a54c25bf19356eabf8c66a2327481d12/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d6b796c652f626f696c6572706c6174652d706870)](https://packagist.org/packages/tomkyle/boilerplate-php)[![PHP version](https://camo.githubusercontent.com/76ad146b0e67b9fd00e1fc63bada041690febe414d4a4a13998096e3ae379c65/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f6d6b796c652f626f696c6572706c6174652d706870)](https://packagist.org/packages/tomkyle/boilerplate-php)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/17673d9c51dfe93782f7b8ba66fef944022d895e8f68d7535358a5fd0e72b293/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f6d6b796c652f626f696c6572706c6174652d7068702f7068702e796d6c)](https://github.com/tomkyle/boilerplate-php/actions/workflows/php.yml)[![Packagist License](https://camo.githubusercontent.com/2365dac7ff4713f5b86828a7ca9e362293e17e71397ef12146c3fd8f15d31613/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6d6b796c652f626f696c6572706c6174652d706870)](LICENSE)

**A template repository for PHP package.**

---

Start new project
-----------------

[](#start-new-project)

```
$ composer create-project tomkyle/boilerplate-php new-project
$ cd new-project
$ composer install
$ npm install
```

### Initial setup

[](#initial-setup)

On first install, the `composer install` command will create two things:

#### 1. Pre-commit hook

[](#1-pre-commit-hook)

The *pre-commit* hook runs the following checks before allowing any `git commit`:

- [PHPUnit](https://phpunit.de/documentation.html) tests
- [PHPStan](https://phpstan.org/) static analysis
- [Rector](https://getrector.com/) to fix code style issues
- [PHP CS Fixer](https://cs.symfony.com/) to format the code

#### 2. Local PHP-CS-Fixer configuration

[](#2-local-php-cs-fixer-configuration)

While the `.php-cs-fixer.dist.php` in the repo basically sets **@PER-CS** as coding standard, the local `.php-cs-fixer.php` override sets the sophisticated **@PhpCsFixer** coding standard. Its opinionated rules are compatible with PER-CS. This setup matches *my* taste but leaves room for customization.

---

Requirements and suggestions
----------------------------

[](#requirements-and-suggestions)

PSR standardrequiresuggestPSR-3 Logger implementation[psr/log](https://packagist.org/packages/psr/log)[Monolog Logger](https://github.com/Seldaek/monolog)PSR-6 Cache Implementation[psr/cache](https://packagist.org/packages/psr/cache)[Symfony Cache component](https://symfony.com/components/Cache)PSR-17 HTTP factory\* implementation[psr/http-factory](https://packagist.org/packages/psr/http-factory)[nyholm/psr7](nyholm/psr7)PSR-18 HTTP client[psr/http-client](https://packagist.org/packages/psr/http-client)[Guzzle 7](https://packagist.org/packages/guzzlehttp/guzzle)```
$ composer require monolog/monolog
$ composer require symfony/cache
$ composer require nyholm/psr7
$ composer require guzzlehttp/guzzle
```

---

Development
-----------

[](#development)

### Watch PHP source code

[](#watch-php-source-code)

Watch the file system for PHP code changes. Unit and code quality tests are automatically triggered. To manually trigger a test run, see [package.json](package.json) for a list of all test tasks:

```
$ npm run watch
```

Whenever a PHP file is changed, the following tasks are run:

- [PHPUnit](https://phpunit.de/documentation.html) test — only for [that very file](https://github.com/tomkyle/find-run-test)
- [PHPStan](https://phpstan.org/) static analysis
- [Rector](https://getrector.com/) to fix code style issues

[PHP CS Fixer](https://cs.symfony.com/) is not automatically applied, but you can invoke it manually with `npm run phpcs` or `npm run phpcs:apply` to apply the changes. It will, however, automatically be executed on `git commit`.

### Available npm scripts:

[](#available-npm-scripts)

```
$ npm run
```

**Overview:**

- **watch** watches `src/` and `tests/` directory
- **phpstan** runs *PHPStan* static analysis
- **phpcs** runs *PHP CS Fixer* as a dry run, use `phpcs:apply` to actually apply changes.
- **rector** runs *Rector* as a dry run, use `rector:apply` to actually apply changes.
- **phpunit** runs *PHPUnit* tests with *textdox* and *coverage* report if available.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance49

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~161 days

Recently: every ~76 days

Total

11

Last Release

371d ago

PHP version history (3 changes)1.0.0PHP ^7.3|^8.0

1.1.0PHP ^7.4|^8.0

1.2.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/412560?v=4)[Carsten Witt](/maintainers/tomkyle)[@tomkyle](https://github.com/tomkyle)

---

Top Contributors

[![tomkyle](https://avatars.githubusercontent.com/u/412560?v=4)](https://github.com/tomkyle "tomkyle (80 commits)")

---

Tags

package-developmentphpphp-boilerplatephp-cs-fixerphpstanphpunitrectorphpphpunitPHPStanboilerplaterectorphp-cs-fixerpackage-develeopment

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomkyle-boilerplate-php/health.svg)

```
[![Health](https://phpackages.com/badges/tomkyle-boilerplate-php/health.svg)](https://phpackages.com/packages/tomkyle-boilerplate-php)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.3k](/packages/symfony-cache)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
