Looking to hire Laravel developers? Try LaraJobs

odorik-sms-laravel maintained by mdcznet

Description
Laravel service for sending SMS via Odorik API
Last update
2025/08/13 01:38 (dev-main)
License
Links
Downloads
1

Comments
comments powered by Disqus

Odorik SMS Laravel Service

A simple Laravel service and facade for sending SMS via the Odorik API.

Features

  • Send SMS using Odorik API from any Laravel app
  • Fetch allowed senders
  • Use as a service or via a Laravel facade

Installation

  1. Require the package via Composer
    (If using locally, see Laravel docs: local packages)

    composer require mdcznet/odorik-sms-laravel
    
  2. Publish the config file

    php artisan vendor:publish --provider="Odorik\Sms\OdorikSmsServiceProvider"
    
  3. Add credentials to your .env

    ODORIK_USER=your_odorik_user
    ODORIK_PASSWORD=your_odorik_password
    ODORIK_API_BASE_URL=https://www.odorik.cz/api/v1
    

Usage

Service (Dependency Injection)

use Odorik\Sms\OdorikSmsService;

public function sendSms(OdorikSmsService $odorik)
{
    $recipient = '00420724000000'; // insert recipient number in international format
    $response = $odorik->sendSms($recipient, 'Test message');
    // handle $response
}

Facade

use Odorik\Sms\Facades\OdorikSms;

public function sendViaFacade()
{
    $recipient = '00420724000000'; // insert recipient number in international format
    $response = OdorikSms::sendSms($recipient, 'Test via facade!');
    // handle $response
}

Fetch allowed senders

$allowedSenders = OdorikSms::getAllowedSenders();

Send SMS with allowed sender

Using the service

use Odorik\Sms\OdorikSmsService;

public function sendSmsWithSender(OdorikSmsService $odorik)
{
    $recipient = '00420724000000'; // insert recipient number in international format
    $allowedSenders = $odorik->getAllowedSenders();
    $sender = $allowedSenders[0]; // or any allowed sender
    $response = $odorik->sendSms($recipient, 'Test message', $sender);
    // handle $response
}

Using the facade

use Odorik\Sms\Facades\OdorikSms;

public function sendSmsWithSenderFacade()
{
    $recipient = '00420724000000'; // insert recipient number in international format
    $allowedSenders = OdorikSms::getAllowedSenders();
    $sender = $allowedSenders[0]; // or any allowed sender
    $response = OdorikSms::sendSms($recipient, 'Test message', $sender);
    // handle $response
}

Testing

You can test the package by calling the service or facade from a controller or route.

Documentation

License

MIT


Author:
Martin Dittrich https://MDCZ.net