Download the PHP package amyavari/iran-sms-laravel without Composer

On this page you can find all versions of the php package amyavari/iran-sms-laravel. 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 iran-sms-laravel

Iran SMS Laravel

PHP Version Laravel Version Packagist Version Packagist Downloads Packagist License Tests

A simple and convenient way to send SMS through Iranian SMS providers.

To view the Persian documentation, please refer to README_FA.md.

برای مشاهده راهنمای فارسی، لطفاً به فایل README_FA.md مراجعه کنید.

WARNING: This package is under development. DON'T use it yet.

Requirements

List of Available SMS Providers

Provider Name (EN) Provider Name (FA) Provider Website Provider Key Version
Trez رایگان اس‌ام‌اس smspanel.trez.ir trez Unreleased
Kavenegar کاوه نگار kavenegar.com kavenegar Unreleased
SMS Online اس‌ام‌اس آنلاین smsonline.ir sms_online Unreleased
Magfa مگفا magfa.com magfa Unreleased
Avanak آوانک avanak.ir avanak Unreleased

Installation

To install the package via Composer, run:

Publish Vendor Files

Publish All Files

To publish all vendor files (config and migrations):

Note: To create tables from migrations:

Publish Specific Files

To publish only the config file:

To publish only the migration file:

Note: To create tables from migrations:

Configuration

Single Provider Setup

To configure a single SMS provider, add the following to your .env file:

Note: For the SMS_PROVIDER, refer to the Provider Key column in the List of Available SMS Providers.

Multiple Provider Setup

After publishing the config file (see Publish Vendor Files), you can customize the environment variable names for each provider you want to use. Then, define those variables in your .env file.

For example, to configure the trez provider:

Define the corresponding variables in your .env file:

Usage

Note: This package supports fluent method chaining like Sms::provider()->otp()->log()->send();, but for simplicity, this manual demonstrates usage with separate instances.

Creating an SMS Instance

You can create an SMS instance using the facade provided by the package:

Note: For the $provider name, refer to the Provider Key column in the List of Available SMS Providers.

Automatic Logging

You can chain log configurations on your SMS instance before sending.

To help keep your code clean and logging consistent, especially when managing SMS sending from a central location, this package provides convenient methods to configure logging behavior based on the SMS type and sending status.

Note: Before using any logging features, make sure to create the necessary tables. (See Publish Vendor Files.)

Log Based on SMS Type

Log Based on Sending Status

Note: These methods implicitly enable logging. If you use them without calling a log*() method first, log(true) will be applied automatically.

Make Your Log Behavior Fluent

You can chain the logging methods to define custom logic fluently:

Sending SMS

To send the SMS:

Note: This method throws an exception if a client or server error occurs. See the throw method in HTTP Client.

Checking Sending Status

To check the status after sending:

Working with Queues and Notifications

Queues

To send an SMS instance using queues, you can create an SMS instance and dispatch it to a job where you call the send() method. You can use the AliYavari\IranSms\Contracts\Sms interface as a constructor type-hint.

Note: It's recommended to configure log options here to keep your code clean and consistent.

Example:

Notifications

To send SMS using notifications, define a toSms method in your notification class and return an SMS instance. Also, include AliYavari\IranSms\Channels\SmsChannel in the via method.

Note: The toSms method must return an SMS instance with your log setup (if desired). The channel will handle sending it.

Example:

Testing

This package provides fluent methods to fake and test SMS sending:

Note: Defining both global behavior and per-provider behaviors together is not allowed in a single call. Use one strategy per fake() call.

Note: If you define multiple behaviors for the same provider, the last one will override the previous definitions.

Contributing

Thank you for considering contributing to the Iran SMS Laravel! The contribution guide can be found in the CONTRIBUTING.md

License

Iran SMS Laravel was created by Ali Mohammad Yavari under the MIT license.


All versions of iran-sms-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.92
illuminate/contracts Version ^11.32 || ^12.0.1
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 amyavari/iran-sms-laravel contains the following files

Loading the files please wait ....