PHPackages                             onsefy/validate-user-laravel - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. onsefy/validate-user-laravel

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

onsefy/validate-user-laravel
============================

Official Laravel SDK for OnSefy – Validate new users, detect fraud, and score risk automatically.

v1.0.1(11mo ago)12MITPHPPHP ^8.0

Since Jun 4Pushed 11mo agoCompare

[ Source](https://github.com/onsefy/validate-user-laravel)[ Packagist](https://packagist.org/packages/onsefy/validate-user-laravel)[ Docs](https://github.com/onsefy/validate-user-laravel)[ RSS](/packages/onsefy-validate-user-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

OnSefy Laravel SDK – Validate Users &amp; Detect Fraud
======================================================

[](#onsefy-laravel-sdk--validate-users--detect-fraud)

[![Latest Version on Packagist](https://camo.githubusercontent.com/827c035ce07eafb7e57f6bf013f77a791cae5b6efbcfe1f639d7209ab062f6bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e736566792f76616c69646174652d757365722d6c61726176656c3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onsefy/validate-user-laravel)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

> Official Laravel SDK for [OnSefy](https://onsefy.com) – Validate new users, detect fraud, and score risk automatically to stop fake signups.

🚀 Features
----------

[](#-features)

- AI Based Quick Intelligent Assessment in microseconds
- Easy integration with Laravel apps
- Validate users with email, phone, IP, and user-agent
- Get detailed fraud risk scoring and patterns
- Detect suspicious users
- Free and paid plan support

---

### 📦 Installation

[](#-installation)

Install the package via Composer:

```
composer require onsefy/validate-user-laravel
```

Laravel 11+ will auto-discover the service provider and facade. If not, add manually to config/app.php:

```
'providers' => [
// ...
OnSefy\Laravel\OnSefyProvider::class,
],

'aliases' => [
// ...
'OnSefy' => OnSefy\Laravel\Facades\OnSefy::class,
],
```

### ⚙️ Configuration

[](#️-configuration)

Publish the config file:

```
php artisan vendor:publish --tag=onsefy-config
```

This will create a config file at config/onsefy. Add your credentials to .env:

```
ONSEFY_PLAN_TYPE=free
ONSEFY_API_KEY=your-api-key-here
ONSEFY_SERVICE_ID=your-service-id-here
```

### 🧠 Usage Example

[](#-usage-example)

use OnSefy;

```
$response = OnSefy::validateUser([
'email' => 'user@example.com',
'phone' => '+13434128780',
'ip' => '103.209.253.36',
'name' => 'John Doe',
'user_agent' => 'mozilla/5.0 (macintosh; intel mac os x 10.15; rv:136.0) gecko/20100101 firefox/136.0',
]);

if ($response['status']) {
// Take action based on risk score or level
$risk = $response['summary']['risk_score'];
$risk_level = $response['summary']['risk_level'];

}
```

### ✅ Recommended Validation Flow

[](#-recommended-validation-flow)

To effectively prevent fake signups and reduce fraud risk, follow this validation strategy:

1. **Pre-validate user data**
    Call `OnSefy::validateUser($userData)` **before** creating or storing a new user record.
2. **Evaluate the response**
    Inspect key indicators from the response:

    - `risk_score` — numerical fraud risk (0 to 10)
    - `verify_level` — 0,1,2 level classification (e.g.,"0 Legit","1 Suspicious", "2 Fraud" )
    - `risk_patterns` — matched signals or warnings (e.g., "x pattern", "y pattern")
3. **Take action based on risk score**

    - **Strict filtering**: Block or flag users with `risk_score > 1`
    - **Loose filtering**: Allow up to `risk_score
