PHPackages                             pieceofcake2/phpstan-cakephp2 - 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. pieceofcake2/phpstan-cakephp2

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

pieceofcake2/phpstan-cakephp2
=============================

An extension to help test CakePHP 2 projects with PHPStan

v0.2.1(8mo ago)06.5k1[1 issues](https://github.com/pieceofcake2/phpstan-cakephp2/issues)[1 PRs](https://github.com/pieceofcake2/phpstan-cakephp2/pulls)20MITPHPPHP ^8.0CI passing

Since Oct 5Pushed 8mo agoCompare

[ Source](https://github.com/pieceofcake2/phpstan-cakephp2)[ Packagist](https://packagist.org/packages/pieceofcake2/phpstan-cakephp2)[ RSS](/packages/pieceofcake2-phpstan-cakephp2/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (2)Used By (20)

PHPStan-CakePHP2
================

[](#phpstan-cakephp2)

[![GitHub License](https://camo.githubusercontent.com/9fe2c644d69aedd84a9c3b18159980f655a0856d2e227c53e82e43bf772337d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70696563656f6663616b65322f7068707374616e2d63616b65706870323f6c6162656c3d4c6963656e7365)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/eff62a398ad198d95078afb413944d81a75a1083b4ff9a1f8a8fad8e586a4d57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70696563656f6663616b65322f7068707374616e2d63616b65706870323f6c6162656c3d5061636b6167697374)](https://packagist.org/packages/pieceofcake2/phpstan-cakephp2)[![PHP](https://camo.githubusercontent.com/a5e2a475a9a4fb7530f3f5c54da2501b2a67dc2bab0bf0998b46d2b64ad7c41b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f70696563656f6663616b65322f7068707374616e2d63616b65706870322f7068703f6c6f676f3d706870266c6f676f436f6c6f723d253233464646464646266c6162656c3d504850266c6162656c436f6c6f723d25323337373742423426636f6c6f723d253233464646464646)](https://packagist.org/packages/pieceofcake2/phpstan-cakephp2)[![Tests](https://camo.githubusercontent.com/07934a7df4587e346050dc4c31412ca5f90b77b833f3020287ea725c23652892/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70696563656f6663616b65322f7068707374616e2d63616b65706870322f43492e796d6c3f6c6162656c3d4349)](https://github.com/pieceofcake2/phpstan-cakephp2/actions/workflows/tests.yml)[![Codecov](https://camo.githubusercontent.com/1e5c857333f6c4631d1fa83245518c0d05c5cdc835e4c7a66204e8b06bc5431c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f70696563656f6663616b65322f7068707374616e2d63616b65706870323f6c6162656c3d436f766572616765)](https://codecov.io/gh/pieceofcake2/phpstan-cakephp2)

PHPStan extensions to help test CakePHP 2 projects with PHPStan

Requirements
------------

[](#requirements)

- PHP 8.0+
- phpstan/phpstan 1.9+
- pieceofcake2/cakephp 2.x

Installation
------------

[](#installation)

Installation is best done through composer:

```
composer require --dev pieceofcake2/phpstan-cakephp2
```

You will need to make sure the extension is included in your phpstan config:

```
# phpstan.neon
includes:
  - vendor/pieceofcake2/phpstan-cakephp2/extension.neon
```

If you have behavior classes in odd locations (perhaps in a vendor directory) you will need to add those locations to your configuration. For example:

```
# phpstan.neon
parameters:
  ModelBehaviorsExtension:
    behaviorPaths:
      - vendor/my-vendor/my-plugin/src/Model/Behavior/*.php
```

See `extension.neon` for the default list of behavior locations.

Features
--------

[](#features)

The following features are added to PHPStan:

- Treat behavior methods as extra methods on all models (`$model->behaviorMethod()`)
- Treat controller properties named after model classes as instances of those classes (`$controller->Model`)
- Treat controller properties named after component classes as instances of those classes (`$controller->Component`)
- Treat component properties names after component classes as instances of those classes (`$component->Component`)
- Treat `ClassRegistry::init($className)` as returning an instance of `$className` where possible

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance59

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50.8% 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

Unknown

Total

1

Last Release

261d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/578548?v=4)[TSURU](/maintainers/ttsuru)[@ttsuru](https://github.com/ttsuru)

---

Top Contributors

[![ariddlestone](https://avatars.githubusercontent.com/u/1448695?v=4)](https://github.com/ariddlestone "ariddlestone (33 commits)")[![sidz](https://avatars.githubusercontent.com/u/1302230?v=4)](https://github.com/sidz "sidz (23 commits)")[![ttsuru](https://avatars.githubusercontent.com/u/578548?v=4)](https://github.com/ttsuru "ttsuru (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pieceofcake2-phpstan-cakephp2/health.svg)

```
[![Health](https://phpackages.com/badges/pieceofcake2-phpstan-cakephp2/health.svg)](https://phpackages.com/packages/pieceofcake2-phpstan-cakephp2)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.6k](/packages/larastan-larastan)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79173.3M2.0k](/packages/phpstan-phpstan-symfony)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67070.7M1.3k](/packages/phpstan-phpstan-doctrine)[shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.

4813.1M82](/packages/shipmonk-dead-code-detector)[spaze/phpstan-disallowed-calls

PHPStan rules to detect disallowed method &amp; function calls, constant, namespace, attribute, property &amp; superglobal usages, with powerful rules to re-allow a call or a usage in places where it should be allowed.

33321.8M508](/packages/spaze-phpstan-disallowed-calls)[mglaman/phpstan-drupal

Drupal extension and rules for PHPStan

20830.6M167](/packages/mglaman-phpstan-drupal)

PHPackages © 2026

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