splash/metadata

Splash Metadata Accessor for Symfony Applications

Installs: 7 164

Dependents: 5

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

pkg:composer/splash/metadata

1.0 2025-02-11 12:18 UTC

This package is auto-updated.

Last update: 2026-02-16 10:43:07 UTC


README

N|Solid

Splash Metadata

PHP Version Symfony License

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

PHPSymfony 5.4Symfony 6.4Symfony 7.0
8.1yesyes--
8.2yesyesyes
8.3--yesyes
8.4----yes

Runtime requirement: splash/php-bundle ^3.0

Documentation

PageDescription
Attributes ReferenceComplete reference of all 24 PHP attributes
FieldsField discovery lifecycle, identifiers, type detection
SubResourcesNested objects, ListResource, separator patterns
MultilingualLanguage attribute, multi-language field grouping
Data TransformersBuilt-in transformers, custom transformer creation
Generic ObjectsGenericDoctrineObject, 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.