splash/metadata
Composer 安装命令:
composer require splash/metadata
包简介
Splash Metadata Accessor for Symfony Applications
README 文档
README
Splash Metadata
Metadata-driven field automation for Splash Sync on Doctrine entities.
Splash Metadata eliminates manual field definitions in Splash connectors by using PHP 8.1+ attributes to automatically discover, configure, and expose Doctrine entity properties as Splash fields.
What It Does
- Automatic field discovery -- annotate your Doctrine entities with PHP attributes, and Splash Metadata collects, types, and publishes fields for you.
- SubResource & ListResource support -- nested objects (addresses, line items) are flattened into child fields with zero boilerplate.
- Built-in data transformation -- PHP types (
DateTime,bool,float, ...) are converted to/from Splash types transparently.
Installation
composer require splash/metadata
The Symfony bundle is registered automatically via Flex.
Quick Start
use Doctrine\ORM\Mapping as ORM;
use Splash\Metadata\Attributes as SPL;
#[ORM\Entity]
#[SPL\SplashObject(name: "Product", ico: "fa fa-box")]
class Product
{
#[ORM\Id]
#[ORM\Column]
#[ORM\GeneratedValue]
public ?int $id = null;
#[ORM\Column]
#[SPL\Field(desc: "Product name")]
#[SPL\Flags(required: true, listed: true, searchable: true)]
#[SPL\Microdata(itemType: "https://schema.org/Product", itemProp: "name")]
public ?string $name = null;
#[ORM\Column(nullable: true)]
#[SPL\Field(desc: "Unit price")]
public ?float $price = null;
#[ORM\Column(nullable: true)]
#[SPL\Field(desc: "Is product active")]
public ?bool $active = null;
}
That's it. The library handles field collection, type detection, and data transformation automatically.
Compatibility
| PHP | Symfony 5.4 | Symfony 6.4 | Symfony 7.0 |
|---|---|---|---|
| 8.1 | yes | yes | -- |
| 8.2 | yes | yes | yes |
| 8.3 | -- | yes | yes |
| 8.4 | -- | -- | yes |
Runtime requirement: splash/php-bundle ^3.0
Documentation
| Page | Description |
|---|---|
| Attributes Reference | Complete reference of all 24 PHP attributes |
| Fields | Field discovery lifecycle, identifiers, type detection |
| SubResources | Nested objects, ListResource, separator patterns |
| Multilingual | Language attribute, multi-language field grouping |
| Data Transformers | Built-in transformers, custom transformer creation |
| Generic Objects | GenericDoctrineObject, AbstractDoctrineObject |
Contributing
All code must pass quality checks before commit:
make quality # Runs lint + style + stan (GrumPHP via badpixxel/php-sdk)
Individual suites:
make lint # Linters (composer, phplint, jsonlint, xmllint, yamllint)
make style # Code standards (phpcpd, phpcs, phpmd, phpcsfixer)
make stan # PHPStan static analysis
Run tests across all supported PHP versions with Docker:
make test # PHPUnit in all containers (PHP 8.1-8.4)
make verify # quality + tests in all containers
License
This project is licensed under the MIT License. See LICENSE for details.
splash/metadata 适用场景与选型建议
splash/metadata 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.5k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 splash/metadata 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 splash/metadata 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-12
