Tenant-scoped automation engine — fire actions when members hit age milestones, tenure, inactivity, or spend thresholds. Build rules in the UI, evaluate on a schedule.
All the tools to build powerful lifecycle automations without writing custom cron jobs.
Five built-in trigger types: age milestones, tenure, inactivity, metric thresholds, and custom field matching — zero boilerplate.
Add AND conditions on any attribute/operator/value pair to filter subjects after the preset fires — all configurable in the Filament UI.
Update member meta, merge tenant settings, notify admins, create reminders, or dispatch Laravel events — extensible via host callbacks.
The rule_execution_logs table ensures rules fire at most once per subject, even if evaluation runs multiple times.
Full CRUD resource inside your existing Filament panel. Build, edit, enable, and audit rules without touching the database directly.
Optionally evaluate rules on member login for real-time trigger checks — useful for birthday greetings and inactivity reset triggers.
Up and running in four steps.
Require via Composer, publish the config and migrations, then run migrate.
$ composer require spiggle/rules-engine $ php artisan vendor:publish --tag=rules-engine-config $ php artisan vendor:publish --tag=rules-engine-migrations $ php artisan migrate
Add the plugin to your Filament panel provider.
use Spiggle\RulesEngine\Filament\RulesEnginePlugin; $panel->plugin(RulesEnginePlugin::make());
Wire up your subject_model, scope_model, resolvers, and action callbacks in config/rules-engine.php.
Build rules in the Filament UI and schedule evaluation.
Schedule::call(function () { app(RuleEvaluator::class) ->evaluateAllActiveRules('scheduled'); })->dailyAt('01:15');
// database/seeders/SampleRuleSeeder.php use Spiggle\RulesEngine\Models\Rule; Rule::create([ 'name' => 'Happy 18th Birthday', 'preset_type' => 'age_milestone', 'preset_params' => [ 'dob_attribute' => 'date_of_birth', 'age' => 18, ], 'conditions' => [], 'actions' => [ [ 'type' => 'notify_scope_admins', 'payload' => [ 'message' => 'Member turns 18 today', ], ], [ 'type' => 'set_member_meta', 'payload' => [ 'key' => 'adult_milestone_reached', 'value' => true, ], ], ], 'is_active' => true, 'scope_id' => null, // null = all scopes ]);
Choose a preset and configure its parameters — no custom evaluator code required.
Fires when a subject's calculated age (from a DOB attribute) reaches a configured number of years.
Params: dob_attribute, age
Fires when a subject has been a member for a configured number of days, calculated from a pivot joined-date attribute.
Params: joined_date_attribute, days
Fires when a subject hasn't been active (checked via a last-active attribute) for more than a configured number of days.
Params: last_active_attribute, days
Fires when a host-provided metric (spend, points, logins…) crosses a threshold. Bind a MetricProviderInterface to enable.
Params: metric_key, operator, value
Fires when any subject attribute satisfies a configured operator/value comparison. Great for dynamic field values and flags.
Params: attribute, operator, value
When a rule fires, one or more actions execute. Chain as many as you need.
| Action | Key | Description |
|---|---|---|
| Set Member Meta | set_member_meta |
Merges a key/value pair into the subject's pivot JSON meta field. |
| Set Scope Settings | set_scope_settings |
Merges a key/value pair into the tenant/scope settings object. |
| Notify Scope Admins | notify_scope_admins |
Calls your host-provided notify_scope_admins callback with a payload. |
| Create Reminder | create_reminder |
Calls your host-provided create_reminder callback with subject + scope. |
| Dispatch Event | dispatch_event |
Fires a named Laravel event with the subject and rule payload — hook your own listeners. |
Rules Engine pairs perfectly with the rest of the Spiggle ecosystem.
Public forms for Laravel + Filament — build once, publish anywhere.
View →Reusable custom field types for Eloquent models with Filament management.
View →Draggable, configurable dashboard widgets for Filament panels.
View →Crisp, clean, and high-energy Filament theme for your Spiggle stack.
View →