PHPackages                             timostamm/orm-resource - 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. [Database &amp; ORM](/categories/database)
4. /
5. timostamm/orm-resource

ActiveLibrary[Database &amp; ORM](/categories/database)

timostamm/orm-resource
======================

Store files in a Doctrine ORM database

v2.0.1(6mo ago)0681MITPHPPHP ^8.0CI passing

Since Sep 20Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/timostamm/orm-resource)[ Packagist](https://packagist.org/packages/timostamm/orm-resource)[ RSS](/packages/timostamm-orm-resource/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

ORM Resources
=============

[](#orm-resources)

[![build](https://github.com/timostamm/orm-resource/workflows/CI/badge.svg)](https://github.com/timostamm/orm-resource/actions?query=workflow:%22CI%22)[![Packagist PHP Version](https://camo.githubusercontent.com/19f82db04738ba0346d315f55034a0f906ff68d9764cec3ed4beec9fc4b1148f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f74696d6f7374616d6d2f6f726d2d7265736f757263652f706870)](https://camo.githubusercontent.com/19f82db04738ba0346d315f55034a0f906ff68d9764cec3ed4beec9fc4b1148f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f74696d6f7374616d6d2f6f726d2d7265736f757263652f706870)[![GitHub tag](https://camo.githubusercontent.com/705107d45924c3083afbf3889c3e117bc6025ea00e68ce6714f2154334f6523b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f74696d6f7374616d6d2f6f726d2d7265736f757263653f696e636c7564655f70726572656c65617365733d26736f72743d73656d76657226636f6c6f723d626c7565)](https://github.com/timostamm/orm-resource/releases/)[![License](https://camo.githubusercontent.com/d6bc2b26794002c24d023acaab01b6dbb953c57ab9cb80ba5b8aa2f2bd5de99a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c7565)](#license)

Doesn't actually store the files in the database, but puts them in a storage directory and references them in the database.

This package uses timostamm/web-resource for file representation.

Files in the file system are never deleted.

Example
-------

[](#example)

The library supports both **PHP 8 Attributes** and **Doctrine Annotations** for mapping definitions.

### Using PHP 8 Attributes

[](#using-php-8-attributes)

```
use Doctrine\ORM\Mapping as ORM;
use TS\Web\Resource\Entity\EmbeddedResource;
use TS\Web\Resource\ResourceInterface;

#[ORM\Entity]
class TestEntity
{
    #[ORM\Embedded(class: EmbeddedResource::class)]
    private $file;

    public function getFile(): ?ResourceInterface
    {
        return $this->file;
    }

    public function setFile(?ResourceInterface $resource): void
    {
        $this->file = EmbeddedResource::create($resource);
    }

}

$em->getEventManager()
    ->addEventSubscriber(new ORMResourceHandler(new HashStorage($storageDir)));

$e = new TestEntity();
$e->setFile(Resource::fromFile(__FILE__));

$em->persist($e);
$em->flush($e);
```

### Using Doctrine Annotations

[](#using-doctrine-annotations)

```
use Doctrine\ORM\Mapping as ORM;
use TS\Web\Resource\Entity\EmbeddedResource;
use TS\Web\Resource\ResourceInterface;

/**
 * @ORM\Entity()
 */
class TestEntity
{
    /**
     * @ORM\Embedded(class = EmbeddedResource::class)
     */
    private $file;

    public function getFile(): ?ResourceInterface
    {
        return $this->file;
    }

    public function setFile(?ResourceInterface $resource): void
    {
        $this->file = EmbeddedResource::create($resource);
    }

}

$em->getEventManager()
    ->addEventSubscriber(new ORMResourceHandler(new HashStorage($storageDir)));

$e = new TestEntity();
$e->setFile(Resource::fromFile(__FILE__));

$em->persist($e);
$em->flush($e);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance66

Regular maintenance activity

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 55% 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 ~646 days

Total

5

Last Release

207d ago

Major Versions

v1.1.0 → v2.0.02025-09-16

PHP version history (3 changes)v1.0.0PHP ^7.1.3

v1.1.0PHP ^7.2 || ^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6364011a12f22cb5046056371bde6170218218c560eddfdc08b4644b7648af78?d=identicon)[timostamm](/maintainers/timostamm)

---

Top Contributors

[![ducrot](https://avatars.githubusercontent.com/u/3525119?v=4)](https://github.com/ducrot "ducrot (11 commits)")[![timostamm](https://avatars.githubusercontent.com/u/4289451?v=4)](https://github.com/timostamm "timostamm (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/timostamm-orm-resource/health.svg)

```
[![Health](https://phpackages.com/badges/timostamm-orm-resource/health.svg)](https://phpackages.com/packages/timostamm-orm-resource)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[pixelfederation/doctrine-resettable-em-bundle

Symfony bundle for decorating default entity managers using a resettable decorator.

20113.5k](/packages/pixelfederation-doctrine-resettable-em-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

813.1k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

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