Eligify is a flexible rule and criteria engine that determines whether an entity — such as a person, application, or transaction — meets the defined acceptance conditions. It powers decision-making systems by making eligibility data-driven, traceable, and automatable.

Fund package maintenance!
Cleanique Coders

Installs: 132

Dependents: 0

Suggesters: 0

Security: 0

Stars: 13

Watchers: 1

Forks: 5

Open Issues: 2

pkg:composer/cleaniquecoders/eligify

1.4.0 2025-11-07 16:56 UTC

This package is auto-updated.

Last update: 2025-11-10 02:39:59 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Eligify is a flexible rule and criteria engine that determines whether an entity — such as a person, application, or transaction — meets the defined acceptance conditions. It powers decision-making systems by making eligibility data-driven, traceable, and automatable.

Eligify

Features

  • 🧱 Criteria Builder - Define eligibility requirements with weighted rules
  • ⚖️ Rule Engine - 16+ operators for comprehensive validation
  • 🎯 Evaluator - Real-time eligibility checks with detailed scoring
  • 🔄 Workflow Manager - Trigger actions on pass/fail/excellent scores
  • 🧾 Audit Log - Complete traceability of all decisions
  • 🎨 Web Dashboard - Optional Telescope-style UI for management (disabled by default)
  • 🧩 Model Integration - Seamless Laravel Eloquent integration
  • 📊 Flexible Scoring - Weighted, pass/fail, percentage, and custom methods
  • Smart Caching - Built-in evaluation and rule compilation caching for optimal performance (experimental)

Installation

You can install the package via composer:

composer require cleaniquecoders/eligify

You can publish and run the migrations with:

php artisan vendor:publish --tag="eligify-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="eligify-config"

Usage

Quick Example

use CleaniqueCoders\Eligify\Facades\Eligify;

// Define criteria
$criteria = Eligify::criteria('Loan Approval')
->addRule('credit_score', '>=', 650, 30)
    ->addRule('annual_income', '>=', 30000, 25)
    ->addRule('debt_ratio',
'<=', 43, 20)
    ->passThreshold(70)
    ->save();

// Evaluate
$result = $criteria->evaluateWithCallbacks($data);

Security

Eligify includes built-in security features:

  • Input Validation: All evaluation data is validated for length and suspicious content
  • Rate Limiting: Configurable rate limits to prevent abuse
  • Authorization: Dashboard access controlled via Gates/closures (similar to Telescope)
  • Audit Logging: Complete audit trail of all evaluations and decisions
  • Safe Operators: Dangerous operators like regex can be disabled in production

Security Configuration

// config/eligify.php
'security' => [
    'validate_input' => true,
    'max_field_length' => 255,
    'max_value_length' => 1000,
    'log_violations' => true,
],

'rate_limiting' => [
    'enabled' => true,
    'max_attempts' => 100,
    'decay_minutes' => 1,
],

Dashboard Authorization

// In AppServiceProvider
Gate::define('viewEligify', function ($user) {
    return $user->hasRole('admin');
});

Performance

Eligify is optimized for high-performance scenarios:

  • Smart Caching: Evaluation results and rule compilation caching
  • Eager Loading: Optimized database queries to prevent N+1 problems
  • Batch Processing: Efficient batch evaluation with memory management
  • Query Optimization: Rules are loaded with criteria to minimize database hits

Performance Configuration

// config/eligify.php
'performance' => [
    'compile_rules' => true,
    'batch_size' => 100,
],

'evaluation' => [
    'cache_enabled' => true,
    'cache_ttl' => 60, // minutes
],

Security

Eligify includes built-in security features:

  • Input Validation: All evaluation data is validated for length and suspicious content
  • Rate Limiting: Configurable rate limits to prevent abuse
  • Authorization: Dashboard access controlled via Gates/closures (similar to Telescope)
  • Audit Logging: Complete audit trail of all evaluations and decisions
  • Safe Operators: Dangerous operators like regex can be disabled in production

Security Configuration

// config/eligify.php
'security' => [
    'validate_input' => true,
    'max_field_length' => 255,
    'max_value_length' => 1000,
    'log_violations' => true,
],

'rate_limiting' => [
    'enabled' => true,
    'max_attempts' => 100,
    'decay_minutes' => 1,
],

Dashboard Authorization

// In AppServiceProvider
Gate::define('viewEligify', function ($user) {
    return $user->hasRole('admin');
});

Performance

Eligify is optimized for high-performance scenarios:

  • Smart Caching: Evaluation results and rule compilation caching
  • Eager Loading: Optimized database queries to prevent N+1 problems
  • Batch Processing: Efficient batch evaluation with memory management
  • Query Optimization: Rules are loaded with criteria to minimize database hits

Performance Configuration

// config/eligify.php
'performance' => [
    'compile_rules' => true,
    'batch_size' => 100,
],

'evaluation' => [
    'cache_enabled' => true,
    'cache_ttl' => 60, // minutes
],

// Result: ['passed' => true, 'score' => 85, 'decision' => 'Approved', ...]


### Optional Web Dashboard

Enable the dashboard for visual management:

```bash
# .env
ELIGIFY_UI_ENABLED=true

Access: http://your-app.test/eligify

Dashboard

Authorization (Production):

// AppServiceProvider.php
Gate::define('viewEligify', function ($user) {
    return $user->hasRole('admin');
});

Complete Documentation

📖 Full Documentation

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.