Download the PHP package prelude-so/laravel without Composer
On this page you can find all versions of the php package prelude-so/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prelude-so/laravel
More information about prelude-so/laravel
Files in prelude-so/laravel
Package laravel
Short Description Laravel integration package for prelude-so/sdk
License MIT
Informations about the package laravel
Prelude Laravel Package
A Laravel integration package for the prelude-so/sdk, providing seamless integration of Prelude services into your Laravel applications.
Requirements
- PHP: 8.1 or higher
- Laravel: 9.0 or higher (supports Laravel 9, 10, and 11)
- Composer: 2.0 or higher
Installation
You can install the package via Composer:
Configuration
Automatic Setup
Run the install command to automatically set up the package:
This command will:
- Publish the configuration file
- Add environment variables to your
.env
file - Provide setup instructions
Manual Setup
If you prefer manual setup:
-
Publish the configuration file:
-
Add your Prelude API credentials to your
.env
file: - Configure the package in
config/prelude.php
as needed.
Usage
Using the Facade
The package provides a convenient facade for accessing Prelude services:
Dependency Injection
You can also inject the PreludeClient
directly into your classes:
SendTransactionalRequest
For sending transactional messages with comprehensive validation:
Complete Examples
For complete working examples, see the examples/UserController.php
file which demonstrates:
- Phone verification creation and checking
- Phone number lookup
- Transactional messaging
- Error handling
- Both Facade and dependency injection patterns
Using the Trait
For models or other classes that frequently interact with Prelude, use the provided trait:
Form Requests with Prelude Integration
The package provides Form Request classes that extend Laravel's FormRequest with comprehensive validation rules for Prelude SDK parameters:
CreateVerificationRequest
For creating verifications with full parameter validation:
CheckVerificationRequest
For checking verification codes with target and code validation:
PredictOutcomeRequest
For predicting outcomes with comprehensive validation:
LookupRequest
For looking up phone number information with comprehensive validation:
SendFeedbackRequest
For sending feedback about verifications with comprehensive validation:
Supported Validation Parameters
CreateVerificationRequest includes validation rules for all SDK parameters:
-
Target (required): Phone number or email validation
target.type
: Must be 'phone_number' or 'email_address'target.value
: Validated based on the target type
-
Signals (optional): Browser/device information
signals.ip_address
: Valid IP addresssignals.user_agent
: Browser user agent stringsignals.device_fingerprint
: Device identification- And more browser-related fields
-
Options (optional): Verification configuration
options.template
: Custom message templateoptions.expiry_minutes
: OTP expiration time (1-60 minutes)options.code_length
: OTP length (4-10 digits)options.channel
: Delivery method (sms, voice, email, whatsapp)- And more configuration options
-
Metadata (optional): Custom tracking data
metadata.user_id
: Your internal user IDmetadata.source
: Request source identifiermetadata.campaign_id
: Marketing campaign trackingmetadata.custom_fields
: Additional custom data
- Dispatch ID (optional): Frontend SDK integration
dispatch_id
: ID from Prelude's JavaScript SDK for enhanced fraud detection
CheckVerificationRequest includes validation rules for verification checking:
-
Target (required): Phone number or email validation
target.type
: Must be 'phone_number' or 'email_address'target.value
: Validated based on the target type
- Code (required): Verification code validation
code
: String with length between 4-10 characters
PredictOutcomeRequest includes validation rules for outcome prediction:
-
Target (required): Phone number or email validation
target.type
: Must be 'phone_number' or 'email_address'target.value
: Validated based on the target type
-
Signals (required): Browser/device information for fraud detection
signals.ip_address
: Valid IP addresssignals.user_agent
: Browser user agent stringsignals.device_fingerprint
: Device identificationsignals.browser_plugins
: Array of browser pluginssignals.screen_resolution
: Screen resolution informationsignals.timezone
: User timezonesignals.language
: User language preferencesignals.session_id
: Session identifiersignals.timestamp
: Request timestamp
-
Metadata (optional): Custom tracking data
metadata.user_id
: Your internal user IDmetadata.source
: Request source identifiermetadata.campaign_id
: Marketing campaign trackingmetadata.reference_id
: Reference identifiermetadata.custom_fields
: Additional custom data
- Dispatch ID (optional): Frontend SDK integration
dispatch_id
: ID from Prelude's JavaScript SDK for enhanced fraud detection
LookupRequest includes validation rules for phone number lookup:
-
Phone Number (required): Phone number in E.164 format
phone_number
: Must be in E.164 format (e.g., +1234567890)- Validates international format with country code
- Length between 7-15 digits (including country code)
- Type (optional): Array of lookup features to retrieve
type
: Optional array of lookup feature stringstype.*
: Each type must be a valid LookupType enum value- Available lookup types (defined in
LookupType
enum):cnam
: Caller Name (CNAM) informationnetwork_info
: Network and carrier informationfraud
: Fraud detection and risk analysis
SendFeedbackRequest includes validation rules for feedback submission:
- Feedbacks (required): Array of feedback objects
feedbacks
: Required array with minimum 1 itemfeedbacks.*.target
: Required target object with phone number or email validationfeedbacks.*.target.type
: Must be 'phone_number' or 'email_address'feedbacks.*.target.value
: Validated based on the target typefeedbacks.*.type
: Required string identifier for the feedback type (max 100 characters)feedbacks.*.signals
: Optional browser/device information for fraud detectionfeedbacks.*.signals.ip_address
: Valid IP addressfeedbacks.*.signals.user_agent
: Browser user agent stringfeedbacks.*.signals.device_fingerprint
: Device identification- And more browser-related fields
feedbacks.*.metadata
: Optional custom tracking datafeedbacks.*.metadata.user_id
: Your internal user IDfeedbacks.*.metadata.source
: Request source identifierfeedbacks.*.metadata.campaign_id
: Marketing campaign trackingfeedbacks.*.metadata.reference_id
: Reference identifierfeedbacks.*.metadata.custom_fields
: Additional custom datafeedbacks.*.dispatch_id
: Optional ID from Prelude's JavaScript SDK for enhanced fraud detection
SendTransactionalRequest includes validation rules for transactional messaging:
-
To (required): Recipient validation
to
: Valid phone number (international format, 7-15 digits) or email address
-
Template ID (required): Message template
template_id
: String identifier for the message template (max 255 characters)
-
Options (optional): Message configuration
options.from
: Sender identifieroptions.channel
: Delivery method (sms, email, whatsapp, voice)options.priority
: Message priority (low, normal, high)options.scheduled_at
: Schedule message for future deliveryoptions.callback_url
: URL for delivery status callbacksoptions.webhook_url
: URL for webhook notificationsoptions.variables
: Template variables for personalizationoptions.attachments
: File attachments (URLs)options.reply_to
: Reply-to email addressoptions.subject
: Email subject lineoptions.tags
: Message tags for categorization
- Metadata (optional): Custom tracking data
metadata.user_id
: Your internal user IDmetadata.source
: Request source identifiermetadata.campaign_id
: Marketing campaign trackingmetadata.reference_id
: External reference IDmetadata.custom_fields
: Additional custom data
Configuration Options
The configuration file (config/prelude.php
) supports the following options:
api_key
: Your Prelude API keybase_url
: The base URL for the Prelude API-
timeout
: Request timeout in seconds defaults
: Default options for SDK operations
Development Environment
Docker Setup (Recommended)
For a consistent development environment, use Docker:
See DOCKER.md for detailed Docker setup instructions.
Local Setup
Alternatively, set up locally with PHP 8.1+ and Composer:
Testing
This package uses Pest for testing.
With Docker:
Local Testing:
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel with dependencies
illuminate/http Version ^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
prelude-so/sdk Version ^1.2.1