ibelieve/larastan-statamic 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibelieve/larastan-statamic

Composer 安装命令:

composer require ibelieve/larastan-statamic

包简介

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

README 文档

README

A PHPStan/Larastan extension for Statamic CMS that provides blueprint-aware static analysis.

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 -> bool, date -> Carbon\Carbon, entries with max_items: 1 -> Entry|null)
  • Provides return types for query builders (Entry::query()->get() returns Collection<int, Entry>)
  • 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

composer require --dev ibelieve/larastan-statamic

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

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 PHP 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<int, Entry>
terms (max_items: 1) LocalizedTerm|null
terms (multiple) array<int, LocalizedTerm>
assets (max_items: 1) Asset|null
assets (multiple) array<int, Asset>
users (max_items: 1) User|null
users (multiple) array<int, User>
select, button_group, radio string|int
checkboxes, array, list, bard, replicator, grid array
Unknown/custom mixed (override via customFieldtypes)

Requirements

  • PHP 8.2+
  • PHPStan 2.0+
  • Statamic 5.0+

ibelieve/larastan-statamic 适用场景与选型建议

ibelieve/larastan-statamic 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ibelieve/larastan-statamic 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ibelieve/larastan-statamic 我们能提供哪些服务?
定制开发 / 二次开发

基于 ibelieve/larastan-statamic 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-22