caneara/triggers
caneara/triggers extends Laravel’s schema builder with database trigger support, so you can create, modify, and drop triggers directly in migrations using a clean, fluent API. Useful for enforcing data integrity and automating database-side logic.
For executives: This is a small, low-cost dependency that lets us define database triggers as part of our normal, reviewable migration process instead of bespoke SQL. The new v1.0.1 release removes a MySQL-only syntax assumption that was blocking trigger creation on other databases — which matters directly to our multi-environment and expansion plans. It reduces the cost and risk of shipping compliance-grade audit logging and data-integrity rules, and it supports rather than replaces our existing Laravel tooling. Risk is contained: it is a patch release, adoption is reversible, and the main caveats are engine-specific behavior and testing discipline, which we can gate with a short proof-of-concept on our target engines.
For engineering: Use this package when you want triggers expressed as migrations — versioned, code-reviewed, and applied consistently across environments. v1.0.1's removal of backtick quoting fixes a hard blocker for non-MySQL engines, so cross-database trigger DDL is now a realistic option rather than a rewrite. Before we standardize, run a spike covering our production engine plus our test/SQLite path: verify trigger creation, rollback behavior, and interaction with schema-diff and existing observers. Keep business-critical rules in application code where feasible and reserve triggers for invariants that must hold regardless of the writer. Document trigger ownership and add integration tests, since trigger logic is invisible to normal unit tests.
How can I help you explore Laravel packages today?