open-southeners/laravel-model-permalink
Laravel package that generates permanent, shareable links for Eloquent models. Create stable permalink URLs for any record with configurable routes and slugs, so entries stay reachable as their content or IDs change.
Architecture fit
laravel-model-permalink is a small, single-purpose package that attaches stable, human-readable permalinks to Eloquent models and resolves them back to model instances. Release 1.1.0 adds OpenSoutheners\LaravelModelPermalink\Events\PermalinkGotAccessed, dispatched when a permalink is resolved through the package's bundled controller. Architecturally this is a low-coupling addition: a standard Laravel event class that integrates with the existing dispatcher, so it slots into any Laravel app without new dependencies, service providers, or configuration. For a TPM, the practical value is that permalink traffic becomes an observable domain event rather than an opaque redirect — enabling analytics, audit logging, cache warming, and rate-limit/abuse handling via ordinary listeners.
Integration feasibility
Very low effort. Adopting the event requires only registering a listener in EventServiceProvider (or via Event::listen) and implementing a handler that receives the model/permalink payload. No schema changes, no migration, no config publishing. The primary constraint is scope: the event is emitted only by the package's own controller, so any team that has wired permalink resolution into a custom route, an API controller, or a non-HTTP context (queues, console commands, sitemap generation) will not see the event fire. That asymmetry must be validated before the team treats the event as a reliable "permalink accessed" signal.
Technical risk Low-to-moderate. Chief risks: (1) Incomplete coverage — custom resolution paths silently bypass the event, producing under-counted telemetry that looks correct; (2) Synchronous listener cost — listeners execute in the request path of a permalink resolution, which is typically latency-sensitive, so anything heavy (DB writes, external HTTP) should be queued; (3) Event payload stability — the event is new in 1.1.0 and its public properties are not yet a proven contract, so downstream code should avoid tight coupling to internals; (4) Minor-version semantics — adding an event is backward compatible, but any listener that throws will now surface as a permalink-resolution failure unless exceptions are swallowed, so error handling in listeners is mandatory.
Key questions
Stack fit Standard Laravel (8+/9+/10+ era) with Eloquent, the default event dispatcher, and the package's service provider auto-discovered. The new event requires no queue, cache, or broadcasting driver; it is compatible with both synchronous and queued listeners. It is a natural fit for teams already standardizing on Laravel events for cross-cutting concerns.
Migration path
Upgrade the constraint to ^1.1 in composer.json, run composer update opensoutheners/laravel-model-permalink, and confirm no other 1.x pins conflict. No data migration, no republish of config or migrations. Then add listeners incrementally — start with a no-op logging listener to confirm dispatch frequency in staging before wiring analytics or audit logic.
Compatibility Backward compatible with 1.0.x: additive only, no removals, no signature changes to existing public API. Requires no PHP or Laravel version bump as described. Downstream risk is confined to listener code, not to the package's existing permalink resolution behavior. Verify against any app that overrides the package routes or controller — those apps get the release safely but gain nothing from it.
Sequencing
^1.1 in a low-traffic environment; verify permalink resolution is unchanged.PermalinkGotAccessed from custom resolution code for consistency.Maintenance Minimal. One Composer constraint bump and one listener registration. Ongoing maintenance is limited to keeping the listener contract aligned if the event payload changes upstream; treat the payload as semi-public and wrap access behind a small internal DTO/adapter if the data feeds reporting.
Support Support burden is low but non-zero: the most likely ticket is "why don't we see permalink access events for X?" where X is a custom route. Pre-empt this with a short internal note stating the event is controller-scoped. Also document that listener exceptions propagate into the resolution request unless explicitly caught.
Scaling Events are in-process and cheap; the scaling question is entirely about listener work. Any listener doing writes or network calls must be queued to avoid adding latency and DB contention to a hot redirect path. At high permalink volume, a queued listener plus sampling is preferable to synchronous per-hit writes. No package-level scalability concerns.
Failure modes
Ramp-up Near-zero for any Laravel developer: registering a listener is idiomatic. Expect under an hour of engineering to adopt and test. The real ramp-up cost is organizational — agreeing on what "accessed" means and whether telemetry must cover non-package resolution paths — which should be settled before instrumentation is treated as authoritative.
How can I help you explore Laravel packages today?