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
Trigger Mapping

Trigger Mapping Laravel Package

talleu/trigger-mapping

Trigger Mapping is a Laravel package for defining and managing database trigger mappings with a clean, fluent API. It helps you connect database events to application logic, keeping trigger definitions organized, readable, and maintainable.

View on GitHub
Deep Wiki
Context7

Trigger mapping bundle

Frequently asked questions about Trigger Mapping
Does talleu/trigger-mapping work with Laravel?
No. Despite being described as a Laravel package in some listings, talleu/trigger-mapping is a Symfony bundle built on Doctrine, and it registers itself through a Bundle class and DependencyInjection extension that Laravel never loads. Laravel's Eloquent, service providers, and Artisan console are a different extension model, so there is no drop-in path. Using it in a Laravel app realistically means forking the framework-agnostic DSL and generator classes and writing your own service provider and Artisan command wrapper. Treat it as evaluate-only for Laravel until that bridge exists.
How do I install talleu/trigger-mapping in a Symfony application?
Install it with Composer, then register the bundle in config/bundles.php for your environment. After that you declare trigger definitions as PHP classes using the provided attributes and run the bundle's console command to push those definitions into the database. It assumes Symfony 6 or 7 with Doctrine DBAL/ORM already configured, so verify your DBAL version before installing. Read the README for the exact command name and bundle alias, since the excerpt does not document them.
Which database engines does trigger-mapping support?
This is the first thing to verify before adopting the package. Trigger DDL is highly dialect-specific: MySQL uses CREATE TRIGGER ... FOR EACH ROW, PostgreSQL needs a separate trigger function plus a CREATE TRIGGER, SQLite has limited trigger support, and SQL Server syntax is different again. A 93-star single-maintainer bundle is unlikely to run a wide CI matrix across all of those. Check the source for the platform classes it ships and confirm your engine and version are covered.
Does talleu/trigger-mapping integrate with Doctrine Migrations?
It appears to run as an out-of-band console command that pushes trigger definitions directly to the database, sitting beside the migration pipeline rather than inside it. That means triggers it creates are invisible to doctrine:migrations:rollback, and Doctrine's schema tool does not model triggers at all. A doctrine:schema:update --force or a naive migration can leave triggers orphaned or duplicated. Teams adopting this should treat migrations as the only schema authority and document the trigger sync as a separate deploy step.
Is the trigger sync command idempotent and safe to re-run?
That depends on whether the package ships a diff or drop-then-create layer, and the overview does not confirm it. If the command simply issues CREATE TRIGGER each time, a second deploy will fail on an existing trigger or create duplicates. Non-idempotent DDL is the single most common cause of failed releases with tools like this. Test the command twice against the same database before wiring it into a deployment pipeline.
Is there a dry-run or diff mode I can use in CI to detect drift?
A dry-run or diff mode is exactly what you want in CI to catch triggers that were changed by hand or left behind by a schema update, but the package documentation does not confirm one exists. If it is missing, you would need to query information_schema.TRIGGERS on MySQL or pg_trigger on PostgreSQL and compare against your mapped classes yourself. Without drift detection, the definition in code and the definition in the database will diverge silently. Verify this capability before adopting.
What database privileges are required to create triggers?
Creating triggers generally requires the TRIGGER privilege on MySQL, and some MySQL configurations additionally require SUPER depending on binary logging settings. On PostgreSQL you need ownership of the table and appropriate rights to create the trigger function. Your deploy user therefore needs more than plain DML permissions, which matters in locked-down production environments. Confirm the exact grants with your DBA before the first sync.
How do I drop or roll back a trigger created by the bundle?
Triggers created outside your migration pipeline are not covered by doctrine:migrations:rollback, so the rollback story is essentially re-running the sync command against a restored database. Check whether the package offers a drop or cleanup command for trigger classes you have deleted from the codebase. If it does not, orphaned triggers will accumulate and fire unpredictably. Document the recovery procedure and rehearse it before you depend on it.
Can I use the package as a standalone PHP library without the Symfony bundle?
Possibly, if the attribute DSL and DDL generator classes are framework-agnostic and live outside the bundle's DependencyInjection layer. That is the part worth reusing in a Laravel or plain-PHP application, since the Symfony wiring is the only piece tied to a framework you are not using. Inspect the source to see whether the core classes have Symfony or Doctrine bundle dependencies baked in. If they are clean, a fork that swaps the bundle layer for a service provider and Artisan command is a realistic weekend project, not a rewrite.
Is talleu/trigger-mapping production ready, and what are the alternatives?
With roughly 93 stars, zero dependents, and a single maintainer, there is essentially no production testimony, so treat it as a promising internal-library candidate rather than a trusted dependency. Version skew is a real concern: DBAL 4 relocated several Platform introspection methods and Symfony 7 tightened service definitions, and a small bundle may not have caught up. The conservative alternative is plain DDL inside Doctrine migrations, written by hand and versioned in your repository, which gives you rollback support for free. Use the package's DSL idea even if you do not adopt the package itself.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect