Weave Code
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

Laravel Column Watcher Laravel Package

ascend/laravel-column-watcher

Attribute-based “column watchers” for Laravel Eloquent models. Trigger handlers only when specific attributes change (before/after save), with support for multiple watchers, queueable handlers, events, and Octane compatibility—avoiding bulky, monolithic model observers.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Granular Event-Driven Logic: Enables fine-grained reactions to specific column changes (e.g., triggering notifications when status updates to "shipped," or validating price adjustments in real-time).
  • Decoupling Business Logic: Shifts column-specific logic (e.g., audit trails, notifications, or workflow triggers) out of model methods, improving maintainability and separation of concerns.
  • Roadmap for Observers Replacement: Justifies phasing out legacy model observers for new features, reducing technical debt by adopting a more scalable, attribute-driven approach.
  • Build vs. Buy: Avoids reinventing column-watching infrastructure, leveraging a battle-tested package with built-in protections (e.g., infinite loop prevention).
  • Use Cases:
    • Audit Trails: Automatically log changes to sensitive fields (e.g., user.roles).
    • Real-Time Notifications: Send alerts when critical columns (e.g., order.status) change.
    • Data Validation: Dynamically validate column updates (e.g., inventory.quantity can’t exceed max_stock).
    • Workflow Triggers: Kick off async processes (e.g., queued emails when user.email_verified changes).

When to Consider This Package

  • Adopt When:

    • Your team frequently writes repetitive Observer logic for column-specific actions.
    • You need fine-grained control over column changes (e.g., "only react to price updates, not all model changes").
    • Your app relies on async handlers (e.g., queued jobs) for column changes, reducing database load.
    • You’re using Laravel 11+ and PHP 8.2+, ensuring compatibility with modern features like attributes.
    • You want to avoid infinite loops (e.g., column watchers triggering recursive model updates).
  • Look Elsewhere If:

    • You need global model events (e.g., "on any model save")—use Laravel’s built-in Observers or Model::saved().
    • Your use case requires complex pre-save validation spanning multiple columns (consider Laravel’s Form Requests or Policy classes).
    • You’re not using Eloquent models (e.g., raw database queries or non-Laravel ORMs).
    • Your team lacks PHP 8.2+ or Laravel 11+ support (package is future-focused).

How to Pitch It (Stakeholders)

For Executives: "This package lets us react to specific data changes—like a customer updating their status—without writing clunky, repetitive code. It’s like setting up automated alerts or actions for critical fields, reducing bugs and speeding up development. For example, we could auto-send a welcome email when a user’s is_active flag flips to true, all without touching the model directly. It’s scalable, maintainable, and cuts down on technical debt."

For Engineers: *"Laravel Column Watcher replaces verbose Observers with clean, attribute-based column listeners. Key benefits:

  • Less Boilerplate: No more bloated Observer classes for simple column reactions.
  • Precision: Watch only the columns you care about (e.g., user.last_login).
  • Async Support: Queue handlers to avoid blocking requests (e.g., sending analytics pings).
  • Safety: Built-in infinite loop protection stops recursive updates.
  • Modern PHP: Uses PHP 8.2 attributes for a clean, declarative syntax.

Perfect for audit logs, notifications, or workflow triggers—just annotate your model and go."*

For Developers: *"Imagine this:

#[Watch(columns: 'status', timing: self::AFTER_SAVE)]
public function handleStatusChange(ColumnChange $change) {
    if ($change->newValue === 'shipped') {
        Notification::send($change->model, new OrderShipped());
    }
}

No more Observer classes or hacky saved() listeners. Try it for your next feature—it’s a game-changer for column-specific logic."*

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.
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky