PHPackages                             codeigniter/phpstan-codeigniter - 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. [Framework](/categories/framework)
4. /
5. codeigniter/phpstan-codeigniter

ActivePhpstan-extension[Framework](/categories/framework)

codeigniter/phpstan-codeigniter
===============================

CodeIgniter extensions and rules for PHPStan

v1.5.4(11mo ago)21544.6k—3.7%2[5 issues](https://github.com/CodeIgniter/phpstan-codeigniter/issues)[1 PRs](https://github.com/CodeIgniter/phpstan-codeigniter/pulls)20MITPHPPHP ^8.1CI passing

Since Aug 27Pushed 6d ago7 watchersCompare

[ Source](https://github.com/CodeIgniter/phpstan-codeigniter)[ Packagist](https://packagist.org/packages/codeigniter/phpstan-codeigniter)[ RSS](/packages/codeigniter-phpstan-codeigniter/feed)WikiDiscussions 1.x Synced 1w ago

READMEChangelog (10)Dependencies (11)Versions (34)Used By (20)

CodeIgniter extensions and rules for PHPStan
============================================

[](#codeigniter-extensions-and-rules-for-phpstan)

[![Extension Tests](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-phpunit.yml/badge.svg)](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-phpunit.yml)[![Coding Standards Check](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-coding-standards.yml/badge.svg)](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-coding-standards.yml)[![PHPStan Static Analysis](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-phpstan.yml/badge.svg)](https://github.com/CodeIgniter/phpstan-codeigniter/actions/workflows/test-phpstan.yml)

- [PHPStan](https://phpstan.org/)
- [CodeIgniter](https://codeigniter.com/)

This extension provides the following features:

- [Type inference](docs/type-inference.md)

### Rules

[](#rules)

- Checks if the string argument passed to `config()` or `model()` function is a valid class string extending `CodeIgniter\Config\BaseConfig` or `CodeIgniter\Model`, respectively. This can be turned off by setting `codeigniter.checkArgumentTypeOfFactories: false` in your `phpstan.neon`. For fine-grained control, you can individually choose which factory function to disable using `codeigniter.checkArgumentTypeOfConfig` and `codeigniter.checkArgumentTypeOfModel`. **NOTE:** Setting `codeigniter.checkArgumentTypeOfFactories: false` will effectively bypass the two specific options.
- Checks if the string argument passed to `service()` or `single_service()` function is a valid service name. This can be turned off by setting `codeigniter.checkArgumentTypeOfServices: false` in your `phpstan.neon`.
- Disallows instantiating cache handlers using `new` and suggests to use the `CacheFactory` class instead.
- Disallows instantiating `FrameworkException` classes using `new`.
- Disallows direct re-assignment or access of `$_SERVER` and `$_GET` and suggests to use the `Superglobals` class instead.
- Disallows use of `::class` fetch on `config()` and `model()` and suggests to use the short form of the class instead.

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

[](#installation)

To use this extension, require it in [Composer](https://getcomposer.org/):

```
composer require --dev codeigniter/phpstan-codeigniter

```

If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!

 Manual installationIf you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:

```
includes:
    - vendor/codeigniter/phpstan-codeigniter/extension.neon
```

Contributing
------------

[](#contributing)

Any contributions are welcome.

If you want to see a new rule or extension specific to CodeIgniter, please open a [feature request](https://github.com/CodeIgniter/phpstan-codeigniter/issues/new?assignees=&labels=feature+request&projects=&template=feature_request.yml). If you can contribute the code yourself, please open a pull request instead.

Before reporting any bugs, please check if the bug occurs only if using this extension with PHPStan. If the bug is reproducible in PHPStan alone, please open a bug report there instead. Thank you!

License
-------

[](#license)

PHPStan CodeIgniter is an open source library licensed under [MIT](LICENSE).

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance73

Regular maintenance activity

Popularity47

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.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

Every ~33 days

Recently: every ~121 days

Total

31

Last Release

15d ago

Major Versions

v1.5.4 → 2.x-dev2026-04-10

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.1.0.70400PHP ^7.4 || ^8.0

2.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/808229fdb6d93fadff56999d343e4235394321e88376a73b2cf41b2192c62b34?d=identicon)[paulbalandan](/maintainers/paulbalandan)

---

Top Contributors

[![paulbalandan](https://avatars.githubusercontent.com/u/51850998?v=4)](https://github.com/paulbalandan "paulbalandan (118 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (2 commits)")

---

Tags

codeignitercodeigniter4phpphpstan-extensionstatic-analysisPHPStandevstatic analysiscodeignitercodeigniter4

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[larastan/larastan

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

6.4k51.0M7.4k](/packages/larastan-larastan)[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.

4753.1M82](/packages/shipmonk-dead-code-detector)[staabm/phpstan-dba

2922.5M2](/packages/staabm-phpstan-dba)[staabm/phpstan-todo-by

2002.0M76](/packages/staabm-phpstan-todo-by)[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87670.5k52](/packages/ticketswap-phpstan-error-formatter)[codeigniter4/devkit

Development toolkit for CodeIgniter libraries and projects

68195.7k113](/packages/codeigniter4-devkit)

PHPackages © 2026

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