PHPackages                             roomies/fraudable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. roomies/fraudable

ActiveLibrary[Security](/categories/security)

roomies/fraudable
=================

Integrate your Laravel app with AWS Fraud Detector

11.8kPHPCI passing

Since Feb 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/roomies-com/fraudable)[ Packagist](https://packagist.org/packages/roomies/fraudable)[ RSS](/packages/roomies-fraudable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Roomies Fraudable
=================

[](#roomies-fraudable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a7793fc75e2ff92776ed6fce56006f87b3f6876bd2d2531f2fdbe480a06b325e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6f6d6965732f667261756461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roomies/fraudable)[![GitHub Tests Action Status](https://camo.githubusercontent.com/befcc9be093090fc6ffe1571e894cb9c43fa720023d197d3b42e5d45db21ba58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f6f6d6965732d636f6d2f667261756461626c652f746573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/roomies-com/fraudable/actions?query=workflow%3Atest+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/39bc16f4ca460757aa85d685918bd91a81232f60a539c65db838e90e6c11eb59/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6f6d6965732f667261756461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/roomies/fraudable)

Roomies Fraudable provides an integration layer between your Laravel app and AWS Fraud Detector. It leverages events and allows you to dispatch/ingest events for training, and later to predict events using your trained models.

Fraudable provides an integration between your Laravel app and AWS Fraud Detector. It leverages Laravel events as a way to ingest data to train models, and then to make predictions about events once you have collected enough data. It provides controls to update events as legitmate or fraudulent to improve your models, and to use prediction data to make assessments in your app.

Note that this is not a plug-and-play solution to detecting fraud. At the very least you will need to configure events, models and detectors in AWS Fraud Detector to get started.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require roomies/fraudable
```

You can publish the config file with:

```
php artisan vendor:publish --tag=fraudable
```

Read through the config file to understand the AWS Fraud Detector integration and run the provided migration.

```
php artisan migrate
```

Getting started
---------------

[](#getting-started)

First add `Fraudable` to the model(s) that will be your "entities" inside AWS Fraud Detector. By default we'll snake-case the full class name to be the "entity" name - `App\Models\User` will become `app_models_user`, as AWS Fraud Detector only allows lowercase letters and underscores.

```
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Roomies\Fraudable\Concerns\Fraudable;

class User extends Authenticatable
{
    use Fraudable
}
```

Next, create events that will map to events inside AWS Fraud Detector. You can use regular Laravel extends and implement the `FraudableEvent` contract. It should return an instance of `PendingEvent` which will include the AWS Fraud Detector event name and the variables to be passed to the event. An instance of the current `Illuminate\Http\Request` will be provided to use for event variables.

```
namespace App\Events\Users;

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Roomies\Fraudable\Contracts\FraudableEvent;
use Roomies\Fraudable\PendingEvent;

class UserCreated implements FraudableEvent
{
    /**
     * Create a new event instance.
     */
    public function __construct(public User $user)
    {
        //
    }

    /**
     * Get the fraud event representation of the event.
     */
    public function toFraudEvent(Request $request): PendingEvent
    {
        $name = Str::of($this::class)->replace('\\', '')->snake()->toString();

        return new PendingEvent(name: $name, variables: [
            'email' => $this->user->email,
            'user_agent' => $request->userAgent(),
        ]);
    }
}
```

In this example we also snake-case the full class name, so `App\Events\Users\UserCreated` becomes `app_events_users_user_created` inside AWS Fraud Detector.

Finally, you can now begin to ingest events for training or prediction.

```
$user = Auth::user();

$event = new App\Events\Users\UserCreated($user);

// Simply record the event to the database - an instance of `Roomies\Fraudable\Models\FraudEvent` is returned.
$fraudEvent = $user->ingest($event);

// Immediately upload the event for training.
$user->ingest($event)->upload();

// Get a prediction for the event
$predication = $user->ingest($event)->predict('detectorId');
```

When you make determinations about an entity you can retroactively update the recorded events.

```
use Roomies\Fraudable\Label;

$user = Auth::user();

$user->relabel(Label::Fraudulent);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd087ea19adfd1f2d44b471f0f4e7075346a8b7c1d5acbccb20ff9fc3815bccd?d=identicon)[dwightwatson](/maintainers/dwightwatson)

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (31 commits)")

### Embed Badge

![Health badge](/badges/roomies-fraudable/health.svg)

```
[![Health](https://phpackages.com/badges/roomies-fraudable/health.svg)](https://phpackages.com/packages/roomies-fraudable)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M117](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
