and this config file:

    'providers' => [
        'example' => [
            'host' => '10.120.2.41',
            'port' => 10010,
            'timeout' => 90,
            'login' => 'test',
            'password' => 'test'
        ]
    ],

<?php

namespace App\Http\Controllers;

use LaravelSmpp\SmppServiceInterface;

class SmsController extends Controller {

protected $smpp;

public function __construct(SmppServiceInterface $smpp)
{
    $this->smpp = $smpp;
}

public function send()
{
    $this->smpp->sendOne('211912230091', 'SMS message');
}

}

1

There are 1 best solutions below

0
Cristofer On

try to use this library: https://github.com/alexandr-mironov/php-smpp

the example in the readme works perfectly for me, you can add something like this in your config file:

   'sms' => [
            'host' => env('SMS_HOST','127.0.0.1'),
            'port' => env('SMS_PORT'),
            'user' => env('SMS_USER'),
            'password' => env('SMS_PASSWORD'),
            'sender' => env('SMS_SENDER'),
            'timeout' => env('SMS_TIMEOUT', 10000),
            'npi' => [
                'src' => env('SMS_SRC_NPI', 1),
                'dst' => env('SMS_DST_NPI', 1),
            ],
            'ton' => [
                'src' => env('SMS_SRC_TON', 1),
                'dst' => env('SMS_DST_TON', 1),
            ]
        ],

good luck