Rules Engine by Spiggle
CommunityTenant-scoped lifecycle rules for Laravel Filament — fire actions when members hit age milestones, tenure, inactivity, or spend thresholds.
Author:
Spiggle
Package health
Automated checks of this plugin's Composer package
15 checks
- Skipped: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Passed: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Skipped: Renovate MR responsiveness
- Skipped: Dependabot or Renovate configured
- Skipped: Dependency update cooldown configured
- Failed: Provides a security policy — View details on Plumb
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 15 days ago; last release 32 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
-
Passed:
Current Laravel version supported
—
Package dependencies resolve together with current Laravel
13.0. -
Passed:
Current PHP version supported
—
Constraint
^8.2supports current PHP8.5. - Skipped: Current Symfony version supported
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
- Why use Rules Engine?
- Features
- Requirements
- Installation
- Quick start
- Preset triggers
- Actions
- Host wiring
- Related Spiggle packages
- License
Tenant-scoped lifecycle rules for Laravel Filament — fire actions when members hit age milestones, tenure, inactivity, or spend thresholds.
| Package | spiggle/rules-engine v1.0.0 |
| License | MIT (free & open source) |
| GitHub | skillbobby/Spiggle-Rules-Engine |
| Docs | Product site & guide |
#Why use Rules Engine?
- Zero-code automation — build lifecycle rules in Filament, no custom artisan commands per trigger
- Preset triggers — age milestones, tenure, inactivity, metric thresholds, and custom field matching out of the box
- Idempotent execution — rules fire at most once per subject per rule, tracked in an audit log
- Visual conditions — AND conditions filter subjects after the preset matches, configurable in the UI
- Tenant-scoped — each scope (organisation / family / team) manages its own rule set
- Host-wired actions — notify admins, create reminders, and dispatch events through your own callbacks
#Features
| Feature | Description |
|---|---|
| Preset triggers | 5 built-in trigger types cover the most common lifecycle events |
| Visual condition builder | AND conditions on attribute / operator / value pairs |
| 5 built-in actions | Meta updates, settings merge, notifications, reminders, events |
| Idempotency | rule_execution_logs prevents duplicate fires |
| Filament UI | Full CRUD for rules inside your existing panel |
| Login evaluation | Optionally evaluate rules on member login |
| Scheduled evaluation | RuleEvaluator::evaluateAllActiveRules() for cron runs |
| Audit trail | Every execution logged with subject, rule, trigger, and outcome |
#Requirements
- PHP 8.2+
- Laravel 11+
- Filament ^5
#Installation
#1. Require the package
composer require spiggle/rules-engine
#2. Publish config & migrations, then migrate
php artisan vendor:publish --tag=rules-engine-config
php artisan vendor:publish --tag=rules-engine-migrations
php artisan migrate
#3. Register the Filament plugin
In your panel provider (e.g. app/Providers/Filament/AdminPanelProvider.php):
use Spiggle\RulesEngine\Filament\RulesEnginePlugin;
$panel->plugin(RulesEnginePlugin::make());
#Quick start
- Sign in to your Filament panel.
- Navigate to Rules Engine → Rules.
- Create a rule, choose a preset trigger and configure its parameters.
- Add optional AND conditions to narrow the subject set.
- Add one or more actions to fire when the rule matches.
- Set the rule to Active.
The engine evaluates all active rules whenever you call:
app(\Spiggle\RulesEngine\Services\RuleEvaluator::class)
->evaluateAllActiveRules('scheduled');
Wire this into your Laravel scheduler:
Schedule::call(function () {
app(\Spiggle\RulesEngine\Services\RuleEvaluator::class)
->evaluateAllActiveRules('scheduled');
})->dailyAt('01:15');
#Preset triggers
| Preset | Key | Parameters |
|---|---|---|
| Age milestone | age_milestone |
dob_attribute, age (years) |
| Tenure milestone | tenure_milestone |
joined_date_attribute, days |
| Inactivity | inactivity |
last_active_attribute, days |
| Metric threshold | metric_threshold |
metric_key, operator, value |
| Custom field match | custom_field_match |
attribute, operator, value |
metric_threshold requires a host-provided binding for MetricProviderInterface.
#Actions
| Action | Key | Description |
|---|---|---|
| Set member meta | set_member_meta |
Merges key/value into the subject pivot JSON meta |
| Set scope settings | set_scope_settings |
Merges key/value into tenant-level settings |
| Notify scope admins | notify_scope_admins |
Calls your notify_scope_admins host callback |
| Create reminder | create_reminder |
Calls your create_reminder host callback |
| Dispatch event | dispatch_event |
Fires a named Laravel event with subject payload |
#Host wiring
Configure config/rules-engine.php to connect the engine to your application's models and callbacks:
return [
// The Eloquent model that represents a "subject" (e.g. a member/user)
'subject_model' => \App\Models\Member::class,
// The Eloquent model that represents a "scope" (e.g. a family/organisation)
'scope_model' => \App\Models\Family::class,
// Resolves the current subject from a context array
'subject_resolver' => function (array $context): ?\App\Models\Member {
return \App\Models\Member::find($context['subject_id'] ?? null);
},
// Resolves the current scope from a context array
'scope_resolver' => function (array $context): ?\App\Models\Family {
return \App\Models\Family::find($context['scope_id'] ?? null);
},
// Gates who can manage rules in the Filament UI
'can_manage_rules' => function (\App\Models\User $user): bool {
return $user->hasRole('admin');
},
// Called by the notify_scope_admins action
'notify_scope_admins' => function ($scope, array $payload): void {
// send your notification here
},
// Called by the create_reminder action
'create_reminder' => function ($subject, $scope, array $payload): void {
// create your reminder here
},
// Optional: bind a MetricProviderInterface implementation for metric_threshold presets
'metric_provider' => null,
];
#Related Spiggle packages
| Package | Description |
|---|---|
| Spiggle Form Builder Core | Public forms for Laravel + Filament |
| Spiggle Dynamic Fields Core | Reusable custom field types for Eloquent models |
| Spiggle Dashlet Core | Draggable dashboard widgets for Filament |
| Spiggle Theme | Crisp, clean, high-energy Filament theme |
#License
MIT — free and open source forever. See LICENSE.
The author
From the same author
Form Builder
A lightweight, open-source package that brings powerful, database-driven form generation to your Laravel and Filament applications.
Author:
Spiggle
Soffit Theme
A soft, calm admin shell for Laravel Filament. Soffit softens the Filament experience with a full-height white sidebar, rounded cards, quiet ambient shadows, and warm teal & brass accents.
Author:
Spiggle
Dynamic Fields
A plug-and-play Filament package that attaches custom fields and validation rules to any Eloquent model.
Author:
Spiggle
Material Theme
A professional Material Design-inspired theme built for Laravel Filament. Perfect for developers and teams who want a sleek, modern admin interface with customizable branding, responsive layouts, and enhanced usability.
Author:
Spiggle
Featured Plugins
A selection of plugins curated by the Filament team
Compact Theme
A theme that makes data-heavy panels easier to scan by fitting more useful information on each screen.
Filament
Noir Theme
A theme that gives panels a focused, refined look with near-black surfaces, crisp actions, and restrained color.
Filament
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle