onsefy/validate-user-laravel

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

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/onsefy/validate-user-laravel

v1.0.1 2025-06-05 05:33 UTC

This package is auto-updated.

Last update: 2025-12-05 06:38:55 UTC


README

Latest Version on Packagist License: MIT

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

🚀 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

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

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

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

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 <= 2, review or throttle above that

This ensures your platform stays protected while balancing user experience.

🛡️ Risk Score Reference

Risk Level Label Action Suggestion
0 – 1.00 Low Proceed
1.01 – 2.50 Suspicious Review or challenge
2.51 Fraud Block and Reject

📝 License

The MIT License (MIT). See LICENSE for details.

💬 Support

👥 Author

OnSefy Stop fake signups. Detect fraud before it costs you. https://onsefy.com