plumthedev/json-shape
Composer 安装命令:
composer require plumthedev/json-shape
包简介
TBA
README 文档
README
Give JSON a shape — typed objects for your database JSON columns in Laravel.
A JSON column comes back from Eloquent as a plain array: no autocomplete, no
static analysis, and a typo only blows up at runtime. JsonShape turns that
array into a typed object you define once, while staying a thin wrapper you can
still treat like an array.
class Example extends Model { public function casts(): array { return ['trace' => AsJsonShape::of(TraceShape::class)]; } } $example->trace->traceId; // string, with autocomplete $example->trace->getDuration(); // int $example->save(); // encoded back to JSON
Installation
Requires PHP 8.4+ and Laravel 13.
composer require plumthedev/json-shape
Documentation
Full guides and examples live at plumthedev.github.io/json-shape:
Development
This project is developed entirely inside Docker, so the only tools you need on your machine are Docker (with the Compose plugin) and Make.
make composer install # install dependencies make code-style-check # Pint (code style) make phpstan # PHPStan (static analysis) make phpunit # PHPUnit (tests) make docs-preview # preview the docs site locally
The default PHP version is 8.4; override it per command with PHP_VERSION
(82, 83, 84), e.g. make phpunit PHP_VERSION=83.
License
Released under the MIT License.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-21