PHPackages                             apie/storage-metadata-builder - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. apie/storage-metadata-builder

ActiveLibrary[File &amp; Storage](/categories/file-storage)

apie/storage-metadata-builder
=============================

Composer package of the apie library: storage metadata builder

1.0.0.x-dev(3mo ago)06.9k1MITPHPPHP &gt;=8.3

Since Mar 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/apie-lib/storage-metadata-builder)[ Packagist](https://packagist.org/packages/apie/storage-metadata-builder)[ RSS](/packages/apie-storage-metadata-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (1)

[![](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)

storage-metadata-builder
========================

[](#storage-metadata-builder)

[![Latest Stable Version](https://camo.githubusercontent.com/a82623a7813bd9ae41816dc9aa106b3b2509725bd881fe5edbf42f562ffc5ef9/68747470733a2f2f706f7365722e707567782e6f72672f617069652f73746f726167652d6d657461646174612d6275696c6465722f76)](https://packagist.org/packages/apie/storage-metadata-builder) [![Total Downloads](https://camo.githubusercontent.com/8bf8ea4cacb6e6eabee0ae9e641ce6190d022a1bc847be048f94e7df1318f14e/68747470733a2f2f706f7365722e707567782e6f72672f617069652f73746f726167652d6d657461646174612d6275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/apie/storage-metadata-builder) [![Latest Unstable Version](https://camo.githubusercontent.com/cf0d012bce4242e88a33169d122a31a6f6fc3f715e8fa36cc5f44bd7d6efce0b/68747470733a2f2f706f7365722e707567782e6f72672f617069652f73746f726167652d6d657461646174612d6275696c6465722f762f756e737461626c65)](https://packagist.org/packages/apie/storage-metadata-builder) [![License](https://camo.githubusercontent.com/730e961975dac1d6b883be106696cd594024173003852c1abbc850030b674f4f/68747470733a2f2f706f7365722e707567782e6f72672f617069652f73746f726167652d6d657461646174612d6275696c6465722f6c6963656e7365)](https://packagist.org/packages/apie/storage-metadata-builder) [![PHP Composer](https://camo.githubusercontent.com/fd62d817c7fafec435bc631dec9fed6e6b259cce1b690bdd0517251934f0df1a/68747470733a2f2f617069652d6c69622e6769746875622e696f2f70726f6a656374436f7665726167652f636f7665726167652d73746f726167652d6d657461646174612d6275696c6465722e737667)](https://apie-lib.github.io/projectCoverage/storage-metadata-builder/index.html)

[![PHP Composer](https://github.com/apie-lib/storage-metadata-builder/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/apie-lib/storage-metadata-builder/actions/workflows/php.yml)

This package is part of the [Apie](https://github.com/apie-lib) library. The code is maintained in a monorepo, so PR's need to be sent to the [monorepo](https://github.com/apie-lib/apie-lib-monorepo/pulls)

Documentation
-------------

[](#documentation)

This package is a ORM agnostic package that helps/creates POPO (plain old php objects) from an Apie domain object that can be used with an ORM. The only library using it now is [apie/doctrine-entity-converter](https://github.com/apie-lib/doctrine-entity-converter) that converts Apie domain objects to Doctrine entities.

### Usage

[](#usage)

You need a BoundedContextHashmap instance for all resources in all bounded contexts. Then you can easily create a builder like this:

```
use Apie\StorageMetadataBuilder\ChainedBootGeneratedCode;
use Apie\StorageMetadataBuilder\ChainedGeneratedCodeContext;
use Apie\StorageMetadataBuilder\ChainedPostGeneratedCodeContext;
use Apie\StorageMetadataBuilder\StorageMetadataBuilder;

$instance = new StorageMetadataBuilder(
    $boundedContextHashmap,
    new ChainedBootGeneratedCode(/* list of class instances that implement BootGeneratedCodeInterface */),
    new ChainedGeneratedCodeContext(/* list of class instances that implement RunGeneratedCodeContextInterface */),
    new ChainedPostGeneratedCodeContext(/* list of class instances that implement PostRunGeneratedCodeContextInterface */)
);
$code = $instance->generateCode();
// this property contains an array with filename => generated php files
$code->generatedCodeHashmap
```

It uses nette\\php-generator ClassType to create classes. Creating actual files is not part of this package.

The actual conversion of a domain object to a storage DTO is done with [apie/storage-metadata](https://github.com/apie-lib/storage-metadata)

### Interfaces of code generators

[](#interfaces-of-code-generators)

There are 3 interfaces:

- BootGeneratedCodeInterface: do these first to create a GeneratedCodeContext mediator object
- RunGeneratedCodeContextInterface: adds new classes with help of ClassTypeFactory
- PostRunGeneratedCodeContextInterface: do aggregate actions, like link the index table to all generated tables or add ORM specific attributes.

### ClassTypeFactory

[](#classtypefactory)

This factory class is made to make ClassType instances with common interfaces and properties etc.

- ClassTypeFactory::createPrimitiveTable(string $tableName, ReflectionType $primitiveTypehint): create a storage table to store a primitive data field (string, bool, int, float, array)
- public static function createStorageTable(string $tableName, ReflectionClass $referencedObject): create a storage table to store a class with properties, for example entities, DTO's and composite value objects.

### Interfaces of generated classes

[](#interfaces-of-generated-classes)

The classes being generated could have these interfaces:

- HasIndexInterface: the storage table is used for search indexes
- MixedStorageInterface: the storage table is used for storing mixed property fields
- RootObjectInterface: the storage table is the root table of a domain object resource and contains references to index tables etc.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance78

Regular maintenance activity

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~312 days

Total

2

Last Release

114d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afaff46a911649ad95e1f4909bb19a54731c209c4bcd4e5c1c7604e05bde2089?d=identicon)[pjordaan](/maintainers/pjordaan)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apie-storage-metadata-builder/health.svg)

```
[![Health](https://phpackages.com/badges/apie-storage-metadata-builder/health.svg)](https://phpackages.com/packages/apie-storage-metadata-builder)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15161.6M2.6k](/packages/illuminate-filesystem)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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