PHPackages                             salavati/sapak-sms-laravel - 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. salavati/sapak-sms-laravel

ActiveLibrary

salavati/sapak-sms-laravel
==========================

The unofficial Laravel integration for the Sapak SMS PHP SDK.

v1.1.0(5mo ago)01MITPHPPHP ^8.1

Since Nov 9Pushed 5mo agoCompare

[ Source](https://github.com/ali-salavati/sapak-sms-laravel)[ Packagist](https://packagist.org/packages/salavati/sapak-sms-laravel)[ Docs](https://github.com/ali-salavati/sapak-sms-laravel)[ RSS](/packages/salavati-sapak-sms-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Sapak SMS - Laravel Adapter
===========================

[](#sapak-sms---laravel-adapter)

This package is an **unofficial** Laravel adapter for the [Sapak SMS API](https://docs.sapak.me/).

It provides a clean, "Laravel-way" integration for the core [sapak-sms-php (Core SDK)](https://github.com/ali-salavati/sapak-sms), automatically registering the `SapakClient` in the Service Container and providing a Facade for easy access.

Table of Contents
-----------------

[](#table-of-contents)

1. [Installation](https://www.google.com/search?q=%231-installation)
2. [Configuration (Required)](https://www.google.com/search?q=%232-configuration-required)
3. [Usage](https://www.google.com/search?q=%233-usage)

    - [A) Using the Facade (Easy Method)](https://www.google.com/search?q=%23a-using-the-facade-easy-method)
    - [B) Using Dependency Injection (DI)](https://www.google.com/search?q=%23b-using-dependency-injection-di)
4. [Calling Core SDK Methods](https://www.google.com/search?q=%234-calling-core-sdk-methods)
5. [Contributing](https://www.google.com/search?q=%235-contributing)
6. [License](https://www.google.com/search?q=%236-license)

1. Installation
---------------

[](#1-installation)

You can install the package via Composer:

```
composer require salavati/sapak-sms-laravel

```

Thanks to Laravel's Auto-Discovery, the Service Provider and Facade will be registered automatically.

2. Configuration (Required)
---------------------------

[](#2-configuration-required)

The only setup required is setting your API key.

### A) Publish the Config File

[](#a-publish-the-config-file)

First, publish the `config/sapak.php` configuration file:

```
php artisan vendor:publish --provider="Sapak\\Sms\\Laravel\\SapakServiceProvider"

```

This will create a new file at `config/sapak.php`.

### B) Set API Key in `.env`

[](#b-set-api-key-in-env)

Open your `.env` file and add your API key (obtained from the Sapak panel):

```
SAPAK_API_KEY="YOUR_API_KEY_HERE"

```

The package automatically reads this variable via the `config/sapak.php` file.

3. Usage
--------

[](#3-usage)

This package registers the `SapakClient` as a **Singleton** in the Service Container. You can access it in two idiomatic "Laravel ways":

### A) Using the Facade (Easy Method)

[](#a-using-the-facade-easy-method)

You can use the `Sapak` Facade for static-like access.

```
use Sapak\Sms\Laravel\SapakFacade as Sapak;
// Or alias it in config/app.php to just `use Sapak;`

Route::get('/test-sms', function () {
    try {
        $creditDto = Sapak::account()->getCredit();
        return "Your credit is: " . $creditDto->credit;
    } catch (\Sapak\Sms\Exceptions\AuthenticationException $e) {
        return "API Key is wrong: " . $e->getMessage();
    }
});
```

### B) Using Dependency Injection (DI)

[](#b-using-dependency-injection-di)

This is the 'cleaner' and preferred method for use in controllers or service classes. Laravel will automatically inject the `SapakClient`.

```
use Sapak\Sms\SapakClient;
use Sapak\Sms\Exceptions\ApiException;

class SmsNotificationService
{
    // Laravel automatically injects the client from the container
    public function __construct(
        private SapakClient $client
    ) {}

    public function getBalance(): float
    {
        try {
            return $this->client->account()->getCredit()->credit;
        } catch (ApiException $e) {
            return 0.0;
        }
    }
}
```

4. Calling Core SDK Methods
---------------------------

[](#4-calling-core-sdk-methods)

This package is just a bridge. All core logic (sending messages, checking status, finding messages) resides in the [sapak-sms-php (Core SDK)](https://github.com/ali-salavati/sapak-sms).

For a complete list of methods and their required DTOs, please read the [**Core Package Documentation**](https://github.com/ali-salavati/sapak-sms/blob/main/README.md).

**Example (Sending a Message):**

```
use Sapak\Sms\Laravel\SapakFacade as Sapak;
use Sapak\Sms\DTOs\Requests\SendMessage; // send($message);

echo "Message ID: " . $results[0]-\>id;
```

5. Contributing
---------------

[](#5-contributing)

Contributions are welcome. Please open a Pull Request on the GitHub repository.

6. License
----------

[](#6-license)

This package is open-source software licensed under the MIT license.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance71

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~21 days

Total

2

Last Release

164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/31b75c8cf97d1a168d01c49d000f13a9066ccade69c3f577ce866c46fdad7766?d=identicon)[ali.salavati](/maintainers/ali.salavati)

---

Top Contributors

[![ali-salavati](https://avatars.githubusercontent.com/u/81990398?v=4)](https://github.com/ali-salavati "ali-salavati (7 commits)")

---

Tags

laravelsdksmssapak

### Embed Badge

![Health badge](/badges/salavati-sapak-sms-laravel/health.svg)

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

###  Alternatives

[kreait/laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

1.3k16.5M42](/packages/kreait-laravel-firebase)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[tzsk/sms

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

320244.3k6](/packages/tzsk-sms)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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