Looking to hire Laravel developers? Try LaraJobs

laravel-inexphone-sms maintained by insightsge

Description
Laravel package for the InexPhone SMS API
Last update
2026/09/11 16:12 (dev-main)
License
Links
Downloads
6

Comments
comments powered by Disqus

💡 About Us & Insights

Laravel InexPhone SMS was created by the team at Insights to provide a clean, reliable, and Laravel-native way to integrate the InexPhone SMS API into modern Laravel applications.

Instead of repeatedly implementing HTTP authentication, request handling, SMS payloads, callbacks, API responses, and error handling for every Laravel project, this package provides a reusable integration built around Laravel's conventions and developer experience.

"Integrate once. Send with confidence. Build more." — PrayerPosition

Why Laravel InexPhone SMS?

  • ⚡ Zero Integration Friction: Install the package with Composer and start sending SMS messages through a simple Laravel API.
  • 📱 Complete SMS Support: Send single, commercial, and bulk SMS messages through a consistent interface.
  • 🔄 Built-in Callbacks: Easily configure submit and delivery callback URLs for tracking SMS events.
  • 🔐 Secure Configuration: API credentials and configuration are managed through Laravel's environment and configuration system.
  • 🎯 Laravel-Native Experience: Automatic service provider discovery, service-container bindings, and a convenient facade make the package feel like a natural part of Laravel.
  • 🛡️ Reliable Error Handling: API failures are represented by a dedicated SmsException, giving applications access to HTTP status codes and API error details.
  • 🧪 Quality First: The package is covered by automated PHPUnit tests and static analysis with Larastan.

✨ Key Features

  • 📤 Single SMS — Send individual SMS messages through the InexPhone API.
  • 📢 Commercial SMS — Send commercial SMS messages.
  • 📱 Bulk SMS — Send the same message to multiple phone numbers.
  • 📋 SMS Listing — Retrieve previously sent SMS messages.
  • 🔎 SMS Lookup — Retrieve a specific SMS using its UUID.
  • 🔄 Submit Callbacks — Receive events related to SMS submission.
  • 📬 Delivery Callbacks — Receive SMS delivery status events.
  • 🚫 Blacklist Control — Optionally ignore blacklist restrictions for supported requests.
  • 🌐 Language Support — Configure the InexPhone API language.
  • 🔐 Bearer Authentication — Secure API authentication using your InexPhone token.
  • ⚙️ Configurable Requests — Configure the API URL and HTTP timeout through Laravel configuration.
  • 🧩 Laravel Package Discovery — No manual service provider registration required.
  • 🎯 Facade Support — Use the convenient Sms facade throughout your application.
  • ❌ Dedicated Exceptions — Handle API errors using SmsException.
  • 🧪 Automated Testing — Core functionality is covered by PHPUnit tests.
  • 🔍 Static Analysis — The package is checked using Larastan/PHPStan.

📋 Requirements

  • PHP: ^8.2
  • Laravel: 11.x, 12.x, or 13.x
  • Composer: ^2.0
  • An active InexPhone SMS API token

⚡ Installation

Install the package using Composer:

composer require insightsge/laravel-inexphone-sms

The package service provider is automatically registered through Laravel package discovery.

No manual provider registration is required.


⚙️ Configuration

Publish the package configuration file:

php artisan vendor:publish --tag=inexphone-sms-config

Add the following variables to your .env file:

INEXPHONE_SMS_BASE_URL=https://smsservice.inexphone.ge/api/v1
INEXPHONE_SMS_TOKEN=your-api-token
INEXPHONE_SMS_LANGUAGE=ka
INEXPHONE_SMS_TIMEOUT=30

Configuration Options

Variable Description Default
INEXPHONE_SMS_BASE_URL InexPhone API base URL https://smsservice.inexphone.ge/api/v1
INEXPHONE_SMS_TOKEN InexPhone API bearer token —
INEXPHONE_SMS_LANGUAGE API language (ka or en) ka
INEXPHONE_SMS_TIMEOUT HTTP request timeout in seconds 30

🔐 Security: Never commit your actual INEXPHONE_SMS_TOKEN to source control. Store your API token in your environment configuration.


🚀 Usage

Import the SMS facade:

use Inexphone\Sms\Facades\Sms;

📤 Send a Single SMS

Send a basic SMS message:

$response = Sms::send(
    phone: '995591950549',
    subject: 'Test',
    message: 'Hello from Laravel!',
);

You can also provide callback URLs and control blacklist behavior:

$response = Sms::send(
    phone: '995591950549',
    subject: 'Test',
    message: 'Hello from Laravel!',
    ignoreBlacklist: true,
    submitCallbackUrl: 'https://example.com/submit',
    deliveryCallbackUrl: 'https://example.com/delivery',
);

📢 Send a Commercial SMS

$response = Sms::sendCommercial(
    phone: '995591950549',
    subject: 'Special Offer',
    message: 'Check out our latest offer!',
);

📱 Send Bulk SMS

Send a message to multiple phone numbers:

$response = Sms::sendBulk(
    subject: 'Announcement',
    message: 'Important announcement.',
    phoneNumbers: [
        '995591111111',
        '995592222222',
    ],
);

Bulk SMS also supports callback URLs:

$response = Sms::sendBulk(
    subject: 'Announcement',
    message: 'Important announcement.',
    phoneNumbers: [
        '995591111111',
        '995592222222',
    ],
    submitCallbackUrl: 'https://example.com/submit',
    deliveryCallbackUrl: 'https://example.com/delivery',
);

📋 List SMS Messages

Retrieve SMS messages:

$response = Sms::list();

You can also pass pagination, sorting, and filters:

$response = Sms::list([
    'page' => 1,
    'perPage' => 15,
    'sort' => '-createDate',
    'filters' => [
        'subject' => 'Test',
        'type' => 'transactional',
        'state' => 'delivered',
        'number' => '995591111111',
        'dateStart' => '01/09/2026',
        'dateEnd' => '08/09/2026',
    ],
]);

Supported Parameters

Parameter Description
page Page number
perPage Number of records per page
sort Sort order
filters.subject Filter by subject
filters.type Filter by SMS type
filters.state Filter by SMS state
filters.number Filter by phone number
filters.dateStart Filter by start date
filters.dateEnd Filter by end date

Supported Sort Values

-createDate
+createDate
-subject
+subject

🔎 Find an SMS

Retrieve a specific SMS by UUID:

$response = Sms::find('sms-uuid');

🔄 Callbacks

The package supports callback URLs for SMS submission and delivery events.

Submit Callback

$response = Sms::send(
    phone: '995591950549',
    subject: 'Test',
    message: 'Hello from Laravel!',
    submitCallbackUrl: 'https://example.com/submit',
);

Delivery Callback

$response = Sms::send(
    phone: '995591950549',
    subject: 'Test',
    message: 'Hello from Laravel!',
    deliveryCallbackUrl: 'https://example.com/delivery',
);

Both callbacks can be provided together:

$response = Sms::send(
    phone: '995591950549',
    subject: 'Test',
    message: 'Hello from Laravel!',
    submitCallbackUrl: 'https://example.com/submit',
    deliveryCallbackUrl: 'https://example.com/delivery',
);

📚 Available Methods

Method Description
Sms::send() Send a single SMS
Sms::sendCommercial() Send a commercial SMS
Sms::sendBulk() Send SMS to multiple phone numbers
Sms::list() Retrieve SMS messages
Sms::find() Retrieve a specific SMS

❌ Error Handling

API errors are represented by the package's SmsException class.

use Inexphone\Sms\Exceptions\SmsException;

try {
    $response = Sms::send(
        phone: '995591950549',
        subject: 'Test',
        message: 'Hello',
    );
} catch (SmsException $exception) {
    $status = $exception->status;
    $errors = $exception->errors;

    // Handle the error...
}

The exception provides:

  • status — HTTP status code returned by the InexPhone API.
  • errors — API validation or error details when available.
  • Exception message — The error message returned by the API.

Example Error Response

{
    "message": "Validation failed",
    "errors": {
        "general": [
            "Invalid phone number"
        ]
    }
}

🧪 Testing

Run the PHPUnit test suite:

vendor/bin/phpunit

Run static analysis with Larastan:

vendor/bin/phpstan analyse

The package includes automated tests covering:

  • Single SMS sending
  • Commercial SMS
  • Bulk messaging
  • Callback URLs
  • API errors
  • Request headers
  • Authentication
  • Configuration
  • Filtering
  • Pagination
  • Facade resolution
  • Service-container bindings

📦 Package Structure

laravel-inexphone-sms/
├── config/
│   └── inexphone-sms.php
├── src/
│   ├── Contracts/
│   │   └── SmsClientInterface.php
│   ├── Exceptions/
│   │   └── SmsException.php
│   ├── Facades/
│   │   └── Sms.php
│   ├── SmsClient.php
│   └── SmsServiceProvider.php
├── tests/
│   └── Feature/
│       └── SmsClientTest.php
├── composer.json
├── phpunit.xml
├── phpstan.neon
├── LICENSE
└── README.md

🤝 Contributing

Contributions, bug reports, and feature requests are welcome.

Before submitting a pull request, please make sure that:

  • All tests pass.
  • Static analysis passes.
  • The code follows the existing project conventions.
  • New functionality includes appropriate tests.

📄 License

The Laravel InexPhone SMS package is open-sourced software licensed under the MIT License.