PHPackages                             jaby/sms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jaby/sms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jaby/sms
========

Package for send Iran sms that work with any company

V1.1.0(1y ago)125434MITPHPPHP &gt;=7

Since Dec 1Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/jabysa/Sms)[ Packagist](https://packagist.org/packages/jaby/sms)[ Docs](https://github.com/Jaby/Sms)[ RSS](/packages/jaby-sms/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (2)Versions (24)Used By (0)

[![alt text](resources/images/icon.png)](resources/images/icon.png)

Laravel Sms Services
====================

[](#laravel-sms-services)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Latest Version on Packagist](https://camo.githubusercontent.com/0bd7d49f2c1cdd936f0b2b5e2b2df94f7bc450964bd42c771661483f898e3092/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6162792f736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jaby/sms)[![Total Downloads on Packagist](https://camo.githubusercontent.com/653afdfda718d28ec568ec027fd65b63045537d10fcd46ffe1228543a1070ed3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6162792f736d732e7376673f636f6c6f723d253233463138267374796c653d666c61742d737175617265)](https://packagist.org/packages/jaby/sms)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7d6eeed57b17e7ec5b1371ce0ff86509e54117354ef65aa44384790ec9275bd9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a61627973612f536d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/jabysa/Sms/?branch=main)

This is a Laravel Package for Sms Services Integration. This package supports `Laravel 5.8+`.

[Donate me](https://sourcecity.ir/banners/) if you like this package &lt;3

For PHP integration you can use [jaby/sms](https://github.com/jaby/sms) package.

> This packages works with multiple drivers, and you can create custom drivers if you can't find them in the [current drivers list](#list-of-available-drivers) (below list).

List of available drivers
=========================

[](#list-of-available-drivers)

- [ippanel](https://ippanel.com/) ✔️
- [farazsms](https://farazsms.com/) ✔️
- [kavenegar](https://kavenegar.com/) ✔️
- [sms.ir](https://sms.ir/) ✔️
- [mellipayamak.com](https://mellipayamak.com/) ✔️
- Others are under way.

**Help me to add the services below by creating `pull requests`**

- farapayamak.ir
- ...

> All services that work with ippanel can used default service `farazsms`

> you can create your own custom drivers if it's not exists in the list, read the `Create custom drivers` section.

Install
-------

[](#install)

Via Composer

```
$ composer require jaby/sms
```

Configure
---------

[](#configure)

If you are using `Laravel 5.5` or higher then you don't need to add the provider and alias. (Skip to b)

a. In your `config/app.php` file add these two lines.

```
// In your providers array.
'providers' => [
    ...
    Jaby\Sms\SmsServiceProvider::class,
],

// In your aliases array.
'aliases' => [
    ...
    'Sms' => Jaby\Sms\Sms::class,
],
```

b. then run `php artisan vendor:publish` to publish `config/sms.php` file in your config directory.

In the config file you can set the `default driver` to use for all your sender. But you can also change the driver at runtime.

Choose what service you would like to use in your application. Then make that as default driver so that you don't have to specify that everywhere. But, you can also use multiple services in a project.

```
// Eg. if you want to use zarinpal.
'default' => 'farazsms',
```

Then fill the credentials for that service in the drivers array.

```
'drivers' => [
    'farazsms' => [
        'username'    => 'username',
        'password'    => 'password',
        'urlPattern'  => 'https://ippanel.com/patterns/pattern',
        'urlNormal'   => 'https://ippanel.com/services.jspd',
        'from'        => '+983000505',
    ],
    ...
]
```

How to use
----------

[](#how-to-use)

available methods:

- `driver`: set the driver
- `text`: set the message to send without pattern
- `patten`: set your pattern code
- `data`: set array of data pattern
- `to`: set array of numbers receivers
- `from`: set sender number
- `send`: send your sms

#### Examples:

[](#examples)

```
Sms::text('Hello')->to(['numbers'])->send();

Sms::driver('your driver')->text('Hello')->to(['numbers'])->send();

Sms::pattern('your pattent code')->data([
    'name' => $name ,
    'code' => $code
])->to(['numbers'])->send();

Sms::...->from('sender number')-> ...->send();
```

#### Create custom drivers:

[](#create-custom-drivers)

First you have to add the name of your driver, in the drivers array and also you can specify any config parameters you want.

```
'drivers' => [
    'farazsms' => [...],
    'my_driver' => [
        ... // Your Config Params here.
    ]
]
```

Now you have to create a Driver Map Class that will be used to send sms.

Eg. You created a class: `App\Packages\Sms\MyDriver`.

```
namespace App\Packages\Sms;

use Jaby\Sms\SmsInterface;

class MyDriver extends SmsInterface
{
    protected $drive = 'farazsms';

    protected $method;

    protected $username;

    protected $password;

    protected $from;

    protected $pattern_code;

    protected $to;

    protected $input_data;

    protected $url;

    protected $numbers;

    protected $data;

    protected $text;

    /**
     * farazsms constructor.
     */
    public function __construct()
    {
        $this->username = config('sms.drivers.'.$this->drive.'.username');
        $this->password = config('sms.drivers.'.$this->drive.'.password');
        $this->from     = config('sms.drivers.'.$this->drive.'.from');
        $this->url      = config('sms.drivers.'.$this->drive.'.urlPattern');
    }

    /**
     * @return bool|mixed|string
     */
    public function send()
    {
        if ($this->method == 'pattern')
            $res = $this->sendPattern();
        else
            $res = $this->message($this->text);
        return $res;
    }

    /**
     * @param $text
     * @return $this|mixed
     */
    public function text($text)
    {
        $this->text = $text;

        return $this;
    }

    /**
     * @param null $pattern_code
     * @return $this|mixed
     */
    public function pattern($pattern_code = null)
    {
        $this->method = 'pattern';
        if ($pattern_code)
            $this->pattern_code = $pattern_code;
        return $this;
    }

    /**
     * @param array $data
     * @return $this|mixed
     */
    public function data(array $data)
    {
        $this->data = $data;

        return $this;
    }

    /**
     * @param $from
     * @return $this|mixed
     */
    public function from($from)
    {
        $this->from = $from;

        return $this;
    }

    /**
     * @param array $numbers
     * @return $this|mixed
     */
    public function to(array $numbers)
    {
        $this->numbers = $numbers;

        return $this;
    }

    /**
     * @return bool|mixed|string
     */
    public function sendPattern()
    {
        $numbers       = $this->numbers;
        $pattern_code  = $this->pattern_code;
        $username      = $this->username;
        $password      = $this->password;
        $from          = $this->from;
        $to            = $numbers;
        $input_data    = $this->data;
        $url = $this->url."?username=" . $username . "&password=" . urlencode($password) . "&from=$from&to=" . json_encode($to) . "&input_data=" . urlencode(json_encode($input_data)) . "&pattern_code=$pattern_code";
        $handler = curl_init($url);
        curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($handler, CURLOPT_POSTFIELDS, $input_data);
        curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($handler);
        return $response;
    }

    /**
     * @param $text
     * @return mixed
     */
    public function message($text)
    {

        $this->url   = config('sms.drivers.'.$this->drive.'.urlNormal');

        $rcpt_nm = $this->numbers;
        $param = array
        (
            'uname'=> $this->username ,
            'pass'=> $this->password,
            'from'=>$this->from,
            'message'=>$text,
            'to'=>json_encode($rcpt_nm),
            'op'=>'send'
        );

        $handler = curl_init($this->url);
        curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($handler, CURLOPT_POSTFIELDS, $param);
        curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
        $response2 = curl_exec($handler);

        $response2 = json_decode($response2);
        $res_code = $response2[0];
        $res_data = $response2[1];

        return $res_data;
    }
}
```

Once you create that class you have to specify it in the `sms.php` config file `map` section.

```
'map' => [
    ...
    'my_driver' => App\Packages\Sms\MyDriver::class,
]
```

**Note:-** You have to make sure that the key of the `map` array is identical to the key of the `drivers` array.

Security
--------

[](#security)

If you discover any security related issues, please email [jaber\_sabzali@yahoo.com](mailto:jaber_sabzali@yahoo.com) instead of using the issue tracker.

Credits
-------

[](#credits)

- [jaber\_sabzali](https://github.com/jabysa)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance56

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Recently: every ~181 days

Total

23

Last Release

366d ago

PHP version history (2 changes)V1.0.0PHP &gt;=7.0.0

1.0.1PHP &gt;=7

### Community

Maintainers

![](https://www.gravatar.com/avatar/9944d88691de3992e24cf6900417b4f456989d50ab093771564ce8c292f3c1ef?d=identicon)[jaby](/maintainers/jaby)

---

Top Contributors

[![jabysa](https://avatars.githubusercontent.com/u/50816951?v=4)](https://github.com/jabysa "jabysa (33 commits)")[![daniyal2959](https://avatars.githubusercontent.com/u/44816659?v=4)](https://github.com/daniyal2959 "daniyal2959 (2 commits)")[![Sajjad-Arjmand](https://avatars.githubusercontent.com/u/39571661?v=4)](https://github.com/Sajjad-Arjmand "Sajjad-Arjmand (1 commits)")

---

Tags

smskavenegarGhasedakiranian-smsIPPanelfarazsmssms irsms iraniran smssms service provider

### Embed Badge

![Health badge](/badges/jaby-sms/health.svg)

```
[![Health](https://phpackages.com/badges/jaby-sms/health.svg)](https://phpackages.com/packages/jaby-sms)
```

###  Alternatives

[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[instasent/sms-counter-php

SMS Counter PHP Class Library which detects encoding of an SMS message text, counts the characters as per the encoding and gives page limit information.

491.3M4](/packages/instasent-sms-counter-php)[alexandr-mironov/php-smpp

PHP SMPP client lib, fork of onlinecity/php-smpp

4864.3k](/packages/alexandr-mironov-php-smpp)[benmorel/gsm-charset-converter

Converts GSM 03.38 strings to and from UTF-8

16423.5k](/packages/benmorel-gsm-charset-converter)[daixianceng/yii2-smser

Yii2 SMS extension

862.9k1](/packages/daixianceng-yii2-smser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
