Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Doctrine Extension Laravel Package

youshido/doctrine-extension

A Doctrine extension for PHP applications that adds convenient helpers and integrations for working with Doctrine ORM entities, repositories, and mappings, streamlining configuration and everyday persistence tasks.

View on GitHub
Deep Wiki
Context7

Getting Started

youshido/doctrine-extension is a 2016-era Doctrine helper package (last tagged release 2016-03-11, zero stars, zero dependents). Before writing any application code, treat adoption as an investigation, not a drop-in.

Verify what you actually installed first. The package name suggests Doctrine integration, and Youshido's ecosystem is predominantly Symfony-oriented, so do not assume a Laravel service provider exists. Inspect the source before assuming a Laravel-friendly bootstrapping path:

composer require youshido/doctrine-extension
composer show youshido/doctrine-extension   # view requires, autoload, suggested
ls vendor/youshido/doctrine-extension      # README, composer.json, src/

Where to look first, in order:

  1. composer.json — check require for doctrine/orm, symfony/*, and the PHP constraint. A 2016 package will typically declare php: >=5.5 or ^7.0, which is a red flag on PHP 8.2+ and with Doctrine ORM 3.x.
  2. The README and any *.md in the repo — for a low-visibility package this is the only authoritative usage guide.
  3. src/ for the entry point: a Symfony Bundle class (*Bundle.php), a service provider, or plain extension/listener classes registered manually.
  4. If it ships only listeners/subscribers (timestampable, soft-delete, tree, sluggable-style behavior), you do not need framework integration — you register them on Doctrine's EventManager yourself.

First use case to validate: wire the package's extension/listener into a single Doctrine EntityManager inside a throwaway test, confirm an entity round-trip still works, and only then expand. Concretely: create an in-memory SQLite entity manager, attach the listener, persist/flush/find one entity, and log emitted SQL. If that fails, stop — the package is not viable for your stack.

Realistic first move for a Laravel developer: check whether you are actually using Doctrine at all. If the app is Eloquent-based, this package provides little value. If you are running Doctrine inside Laravel (e.g., via laravel-doctrine/orm), the useful part is almost certainly the event listeners, which you can register from your own service provider without adopting the package's wiring.

Implementation Patterns

Pattern 1 — Manual listener registration (most portable). Skip whatever bundle/provider the package offers and attach its listeners to Doctrine's event manager in a service provider:

// AppServiceProvider::boot()
$em = $this->app->make(\Doctrine\ORM\EntityManagerInterface::class);

$events = $em->getEventManager();
$events->addEventSubscriber(new \Youshido\DoctrineExtension\...\Subscriber());

This keeps you framework-agnostic and makes the package easy to remove later.

Pattern 2 — Config-first, code-second. If the package exposes configuration (table/column naming, enabled flags, driver options), publish or copy it into your own config/doctrine.php rather than relying on the vendor defaults. Vendor default config from 2016 rarely matches modern conventions (naming strategies, quoting, MySQL 8 requirements).

Pattern 3 — Repository and DQL helpers behind your own interface. If the package provides query/filter helpers, wrap them in your own repository base class so application code depends on your API, not the vendor namespace. That gives you a one-file escape hatch if the package breaks on a Doctrine upgrade.

Pattern 4 — Integration test around behavior, not wiring. Test at the entity-manager level with SQLite in memory: persist an entity, flush, re-fetch, assert the extension's effect (a timestamp set, a soft-delete flag applied, a slug generated). These tests survive refactors and immediately reveal breakage on composer updates.

Pattern 5 — Event-driven extension. If you only need one or two behaviors, reimplement them as your own Doctrine EventSubscriber (typically prePersist/preUpdate/onFlush/loadClassMetadata). A 20-line subscriber is often cheaper and safer than carrying an unmaintained dependency for one feature.

Workflow tip: pin the package to an exact version ("youshido/doctrine-extension": "0.x.y" — no caret) and add it to your dependency-risk register. Do not let composer update silently move it.

Gotchas and Tips

Compatibility is the primary risk. A 2016 package predates Doctrine ORM 3.x, PHP 8 attributes, and modern Symfony. Expect deprecation noise, possible fatal errors on PHP 8+, and signature mismatches in EventSubscriber/EventArgs classes. Run composer why-not youshido/doctrine-extension and a composer update --dry-run in a branch before committing.

Abandonment reality check. Zero stars, zero dependents, no release in ~9 years. Treat it as a vendored snippet source, not a maintained library. If you adopt it, consider copying the relevant classes into your own namespace (with license attribution) so you control fixes.

Annotations vs attributes. If the package reads Doctrine annotations via doctrine/annotations, note that annotations are deprecated in favor of attributes in modern Doctrine. Any package-provided mapping or docblock-driven behavior may be silently ignored under an attribute-based setup.

Debugging Doctrine extensions is event-driven debugging. The classic symptom is "my listener does nothing." Checklist:

  • Confirm the listener is on the same EventManager instance as the EM in use (multi-connection apps often have several).
  • Confirm the event actually fires (add temporary error_log in the callback; preUpdate only fires when a mapped field changed).
  • Enable SQL logging (doctrine.dbal.logging: true) and inspect onFlush/postFlush ordering.
  • In Symfony, check the container for the listener service; in Laravel, check your provider's boot() actually ran (php artisan about / a debug route).

onFlush ordering pitfalls. Extensions that mutate state during onFlush must use UnitOfWork::computeChangeSet correctly; get it wrong and you get "entity was not found in the identity map" or silent non-persistence. Test any flush-time behavior specifically.

Metadata/loadClassMetadata conflicts. Extensions that alter mapping (naming strategies, inheritance) can clash with your own loadClassMetadata listeners. Register order matters; validate the final metadata with vendor/bin/doctrine orm:validate-schema (or the Doctrine command available in your app).

Extension points to prefer. Rather than patching vendor code, extend by (a) your own EventSubscriber, (b) a custom NamingStrategy, (c) a DQL filter, or (d) a repository base class. All four survive package replacement.

Config quirks. If configuration is read at compile time (Symfony container) versus runtime (Laravel config), changes may require a cache clear. Always clear framework caches after touching Doctrine config — a stale compiled container is a frequent false negative when debugging.

Final recommendation. For a greenfield or actively maintained Laravel codebase in 2025, avoid adding this dependency. Mine it for the specific behavior you need, reimplement as a small event subscriber, and keep your Doctrine layer on supported packages.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console