Download the PHP package mr-rijal/laravel-sms without Composer

On this page you can find all versions of the php package mr-rijal/laravel-sms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-sms

Laravel SMS

Workflow Latest Version PHP Laravel Downloads

One fluent API for sending SMS from Laravel through 20 providers, with failover, queueing, notifications, delivery webhooks and first-class testing.

Highlights

Requirements

Laravel PHP
13.x 8.3 – 8.5
12.x 8.2 – 8.5
11.x 8.2 – 8.5

Laravel 11 is past its security-support window. Use Laravel 12 or 13 in production.

Installation

Pick a provider and add its credentials to .env:

Check the setup with a real message:

Providers

Provider Key Coverage Environment variables
Twilio twilio Global TWILIO_SID, TWILIO_TOKEN, TWILIO_FROM or TWILIO_MESSAGING_SERVICE_SID
Vonage vonage Global VONAGE_KEY, VONAGE_SECRET, VONAGE_FROM
Sinch sinch Global SINCH_SERVICE_PLAN_ID, SINCH_API_TOKEN, SINCH_FROM, SINCH_REGION
Bird (MessageBird) bird Global BIRD_API_KEY, BIRD_FROM, BIRD_REGION, BIRD_CATEGORY
Plivo plivo Global PLIVO_AUTH_ID, PLIVO_AUTH_TOKEN, PLIVO_FROM
Telnyx telnyx Global TELNYX_API_KEY, TELNYX_FROM or TELNYX_MESSAGING_PROFILE_ID
Infobip infobip Global INFOBIP_API_KEY, INFOBIP_SENDER, INFOBIP_BASE_URL
ClickSend clicksend Global CLICKSEND_USERNAME, CLICKSEND_API_KEY, CLICKSEND_FROM
Clickatell clickatell Global CLICKATELL_API_KEY, CLICKATELL_FROM
Brevo brevo Global BREVO_API_KEY, BREVO_SMS_SENDER, BREVO_SMS_TYPE
Bandwidth bandwidth US / Canada BANDWIDTH_ACCOUNT_ID, BANDWIDTH_APPLICATION_ID, BANDWIDTH_CLIENT_ID, BANDWIDTH_CLIENT_SECRET, BANDWIDTH_FROM
SendPulse sendpulse Global SENDPULSE_CLIENT_ID, SENDPULSE_CLIENT_SECRET, SENDPULSE_SENDER
Amazon SNS aws_sns Global AWS_DEFAULT_REGION (+ keys, or an IAM role) — needs composer require aws/aws-sdk-php
WhatsApp Cloud API whatsapp Global WHATSAPP_PHONE_NUMBER_ID, WHATSAPP_ACCESS_TOKEN
MSG91 msg91 India MSG91_AUTHKEY, MSG91_SENDER
Sparrow SMS sparrow Nepal SPARROW_TOKEN, SPARROW_FROM
Termii termii Africa TERMII_API_KEY, TERMII_SENDER_ID, TERMII_CHANNEL
Sendchamp sendchamp Africa SENDCHAMP_API_KEY, SENDCHAMP_SENDER_NAME, SENDCHAMP_ROUTE
Africa's Talking africastalking Africa AFRICASTALKING_API_KEY, AFRICASTALKING_USERNAME
BulkSMS bulksms Global BULKSMS_TOKEN_ID, BULKSMS_TOKEN_SECRET
Failover failover — SMS_FAILOVER_DRIVERS=twilio,vonage
Log (development) log — SMS_LOG_CHANNEL (optional)
Fake (tests) fake — —

Templates (->template($id, $vars)) are supported by MSG91 (DLT flows), WhatsApp (approved templates) and Brevo (SMS templates). The other providers need message text.

Sending

Numbers may contain spaces, dashes, dots and parentheses; they are normalized before sending.

Results and errors

sendNow() returns an SmsResult:

When a provider rejects a recipient, a DeliveryException is thrown. It tells you exactly what happened:

Every package exception implements MrRijal\LaravelSms\Exceptions\SmsException. Invalid input throws InvalidMessageException, and bad configuration throws InvalidConfigurationException.

Queueing

Set SMS_QUEUE=true to make send() queue by default (then send() returns null). Queued messages are split into one job per recipient, so a provider error for one recipient never makes the retry re-send to the others. Jobs are encrypted with your APP_KEY.

SMS delivery is still at-least-once: if a provider accepts a message but the response is lost (a timeout, a dropped connection), the retry, or failover, can send it to that recipient again.

Failover and load balancing

Failover tries each provider in order. If Twilio accepts 98 of 100 recipients, only the 2 failed numbers go to Vonage.

For simple load balancing, set the provider to random and list the pool in sms.random_drivers.

Speed

Providers with a bulk endpoint (Sinch, Plivo, Infobip, ClickSend, Clickatell, Sparrow, Sendchamp, Africa's Talking, BulkSMS, SendPulse, MSG91 templates) receive one request for every recipient. The rest send per-recipient requests concurrently:

OAuth providers (Bandwidth, SendPulse) cache their access tokens until shortly before they expire.

Notifications

Return an SmsMessage (or a plain string) from toSms():

Route notifications with routeNotificationForSms() on the notifiable, or on demand:

For quick one-offs, use the bundled SmsNotification:

The HasSms trait adds $user->sms('...') and $user->smsTemplate($id, $vars).

Events

Event When Properties
SmsSending Before sending. Return false from a listener to cancel. message, provider
SmsSent After the provider accepted the message message, provider, result
SmsFailed After a send failed (the exception is re-thrown) message, provider, exception
SmsWebhookReceived After a verified provider webhook provider, payload, messageId, status, recipient

Webhooks

Delivery reports and inbound messages are received at POST /laravel-sms/webhook/{provider} (route name sms.webhook) for WhatsApp, Termii, Sendchamp, Africa's Talking and BulkSMS.

Every webhook fails closed: requests are rejected with 401 unless the secret is configured and verified. Africa's Talking does not sign callbacks, so add the secret to the callback URL: …/webhook/africastalking?token=<secret>. The token is stripped before your listeners see the payload.

Webhook routes use the stateless api middleware group with throttle:120,1. Change sms.webhooks.middleware and SMS_WEBHOOKS_PREFIX as needed. Custom drivers can receive webhooks by implementing Contracts\HandlesWebhooks.

Custom drivers

Register it in config/sms.php under drivers (and its credentials under providers), or at runtime:

Any class implementing Contracts\SmsProvider works as a driver.

Testing

Sms::fake() fires the same events and resolves providers like a real send, so a typo in a provider name still fails your test. It keeps drivers registered with Sms::extend().

To test an HTTP driver end to end without network calls, use Http::fake(). The AWS SNS driver uses the AWS SDK instead, so pass a mocked SnsClient to new AwsSnsDriver($config, $client).

Run the package's own checks with composer ci (Pint, PHPStan at max level, and PHPUnit). CI covers PHP 8.2–8.5 × Laravel 11–13.

Upgrading

See CHANGELOG.md for all changes.

Contributing

Contributions are welcome. Please see CONTRIBUTING.md.

Security

If you discover a security issue, please email SECURITY.md.

Credits

Support

If this package is useful to you, you can support its maintenance via buymemomo.com/rijal.

License

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


All versions of laravel-sms with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/cache Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/notifications Version ^11.0|^12.0|^13.0
illuminate/queue Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mr-rijal/laravel-sms contains the following files

Loading the files please wait ...