PHPackages                             ibelieve/larastan-statamic - 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. ibelieve/larastan-statamic

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

ibelieve/larastan-statamic
==========================

PHPStan/Larastan extension for Statamic CMS - blueprint-aware static analysis

11PHPCI passing

Since Feb 22Pushed 4mo agoCompare

[ Source](https://github.com/iBelieve/larastan-statamic)[ Packagist](https://packagist.org/packages/ibelieve/larastan-statamic)[ RSS](/packages/ibelieve-larastan-statamic/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (6)Used By (0)

larastan-statamic
=================

[](#larastan-statamic)

A PHPStan/Larastan extension for [Statamic CMS](https://statamic.dev) that provides blueprint-aware static analysis.

What it does
------------

[](#what-it-does)

Statamic uses YAML blueprint files to define content schemas. Fields defined in blueprints are accessed as magic properties (`$entry->title`, `$entry->body`, etc.), which PHPStan can't understand on its own. This extension:

- **Resolves blueprint fields as typed properties** on `Entry`, `Term`, `Asset`, and `Variables` (GlobalSet) classes
- **Maps Statamic fieldtypes to PHP types** (e.g., `toggle` -&gt; `bool`, `date` -&gt; `Carbon\Carbon`, `entries` with `max_items: 1` -&gt; `Entry|null`)
- **Provides return types for query builders** (`Entry::query()->get()` returns `Collection`)
- **Provides return types for facades** (`Entry::find()` returns `Entry|null`, `GlobalSet::findByHandle()` returns `GlobalSet|null`)
- **Optional strict mode** that warns when accessing fields not defined in any blueprint

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

[](#installation)

```
composer require --dev ibelieve/larastan-statamic
```

The extension is automatically registered via PHPStan's extension discovery.

Configuration
-------------

[](#configuration)

Add to your `phpstan.neon`:

```
parameters:
    statamic:
        # Paths to your blueprint directories (defaults to resources/blueprints)
        blueprintPaths:
            - resources/blueprints

        # Map custom fieldtype names to PHP class names
        customFieldtypes:
            my_addon_field: App\Fieldtypes\MyAddonValue

        # Enable strict mode to warn about fields not in any blueprint
        strictMode: false
```

Fieldtype Mappings
------------------

[](#fieldtype-mappings)

FieldtypePHP Type`text`, `textarea`, `markdown`, `slug`, `code`, `color`, `html`, `video`, `template`, `link`, `time`, `yaml``string``toggle``bool``integer`, `range``int``float``float``date``Carbon\Carbon``entries` (max\_items: 1)`Entry|null``entries` (multiple)`array``terms` (max\_items: 1)`LocalizedTerm|null``terms` (multiple)`array``assets` (max\_items: 1)`Asset|null``assets` (multiple)`array``users` (max\_items: 1)`User|null``users` (multiple)`array``select`, `button_group`, `radio``string|int``checkboxes`, `array`, `list`, `bard`, `replicator`, `grid``array`Unknown/custom`mixed` (override via `customFieldtypes`)Requirements
------------

[](#requirements)

- PHP 8.2+
- PHPStan 2.0+
- Statamic 5.0+

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance52

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78113dddc9400f8fde5667a61041e02649f030f4f886acd206738bc8bc8cd270?d=identicon)[iBelieve](/maintainers/iBelieve)

---

Top Contributors

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

---

Tags

code-analysislarastanphpstanphpstan-extensionstatamicstatic-analysis

### Embed Badge

![Health badge](/badges/ibelieve-larastan-statamic/health.svg)

```
[![Health](https://phpackages.com/badges/ibelieve-larastan-statamic/health.svg)](https://phpackages.com/packages/ibelieve-larastan-statamic)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M361](/packages/dms-phpunit-arraysubset-asserts)[gong023/assert_chain

enable you to use phpunit assert with method chain

1478.9k3](/packages/gong023-assert-chain)

PHPackages © 2026

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