Search by

hasanalyazidi / laravel-sendables

hasanalyazidi

Send SMS and OTP

Package info

github.com/HasanAlyazidi/laravel-sendables

pkg:composer/hasanalyazidi/laravel-sendables

Statistics

Installs: 137

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v3.2.0 2026-09-23 03:04 UTC

This package is not auto-updated.

Last update: 2026-09-23 04:35:38 UTC


README

Software License Travis Total Downloads

Install

  1. Add package to your composer.json
composer require hasanalyazidi/laravel-sendables
  1. Migrate package tables or publish migrations first then migrate
php artisan migrate

Publish package files

Publish config file (Required)

php artisan vendor:publish --provider="HasanAlyazidi\Sendables\Providers\SendablesServiceProvider" --tag="config"

Publish migrations (Optional)

php artisan vendor:publish --provider="HasanAlyazidi\Sendables\Providers\SendablesServiceProvider" --tag="migrations"

Publish language resources (Optional)

English

php artisan vendor:publish --provider="HasanAlyazidi\Sendables\Providers\SendablesServiceProvider" --tag="resources-lang-en"

Arabic

php artisan vendor:publish --provider="HasanAlyazidi\Sendables\Providers\SendablesServiceProvider" --tag="resources-lang-ar"

All supported languages

php artisan vendor:publish --provider="HasanAlyazidi\Sendables\Providers\SendablesServiceProvider" --tag="resources-lang-all"

Usage

SMS

$sms = new SMSNotification('SMS Message', '966000000000');
$sms->send();

OTP

$otp = new OtpVerifier('966000000000');
$otp->send();
  • WhatsApp:
    Add a message template named otp_code, type (Authentication) with your app supported languages.

OTP limits

Codes sent by the server (WhatsApp, SMS) are limited per mobile number. Set them in config/sendables.php under otp.limits; a provider takes its own value first, then the default one, then OtpProvider::DEFAULT_LIMITS.

Limit Default Meaning
resendAfterSeconds [60, 120, 300] Wait after the 1st, 2nd, 3rd... code of the last hour; the last value repeats. A single number means the same wait every time.
maxSendsPerHour 10 Codes per hour per mobile number.
maxWrongAttempts 5 Wrong guesses allowed per code, then a new code is needed.
verifiedForMinutes 60 How long a verified code proves the number to isAuthenticated().
'limits' => [
    'default' => OtpProvider::DEFAULT_LIMITS,

    'providers' => [
        OurSMSV2OtpProvider::class => [
            'resendAfterSeconds' => [120, 300],
            'maxSendsPerHour'    => 5,
        ],
    ],
],

Tell the client when it may ask for another code, and pass it in your send response:

$otp->getResendAfter(); // seconds

A refused send returns false with the error too-many-requests, and too many wrong guesses return too-many-attempts; both have messages in the package language files. Limits apply to providers that send from the server, not to Firebase (the phone sends it), testers or password logins.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email hassanx220@gmail.com instead of using the issue tracker.

License

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