LaravelPackages.net
Acme Inc.
Toggle sidebar
textlk/textlk-laravel

Text.lk - SMS Gateway Sri Lanka

100
2
v1.1.0
About textlk/textlk-laravel

textlk/textlk-laravel is a Laravel package for text.lk - sms gateway sri lanka. It currently has 2 GitHub stars and 100 downloads on Packagist (latest version v1.1.0). Install it with composer require textlk/textlk-laravel. Discover more Laravel packages by textlk or browse all Laravel packages to compare alternatives.

Last updated

TextLK Laravel SMS Package

Latest Version on Packagist Total Downloads License

Official Laravel / PHP SDK for sending SMS via Text.lk πŸš€

PHP Version Laravel

Easily integrate Text.lk SMS services into your Laravel or PHP applications.


✨ Features

  • Send SMS messages via Text.lk API
  • Supports single & multiple recipients
  • Plain text SMS support
  • Scheduled SMS support
  • Check account balance
  • Fetch account profile
  • Lightweight & simple API

πŸ“¦ Installation

Install the package via Composer:

composer require textlk/textlk-laravel

βš™οΈ Configuration

1. Get your API Key

Login to your Text.lk Dashboard and generate an API key.

2. Laravel Environment (.env)

Add your API key to .env:

TEXTLK_API_KEY=your_api_key_here

πŸš€ Usage

Laravel Example

use TextLK\SMS;

$SMS = new SMS(config('services.textlk.api_key'));

$data = [
    "recipient" => "9476000000", // or "+9476000000,+9476111000"
    "sender_id" => "TEXTLK",
    "type" => "plain",
    "message" => "Boom! Message from Text.lk"
    // "schedule_time" => "2021-12-20T07:00:00Z"
];

$response = $SMS->send($data);

return $response;

πŸ§ͺ Plain PHP Example (example.php)

<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

require '../vendor/autoload.php';

use TextLK\SMS;

// Set your API key
$api_key = 'YOUR_API_KEY';

// Instantiate SMS class
$SMS = new SMS($api_key);

$data = [
    "recipient" => "9476000000", // or "+9476000000,+9476111000"
    "sender_id" => "TEXTLK",
    "type" => "plain",
    "message" => "Boom! Message from Text.lk"
    // "schedule_time" => "2021-12-20T07:00:00Z"
];

echo $SMS->send($data);

// echo $SMS->getBalance();
// echo $SMS->getProfile();

πŸ“€ Send SMS Parameters

| Parameter | Required | Description | | --------------- | -------- | --------------------------------- | | recipient | βœ… Yes | Mobile number(s), comma separated | | sender_id | βœ… Yes | Approved Sender ID | | type | βœ… Yes | plain | | message | βœ… Yes | SMS content | | schedule_time | ❌ No | ISO 8601 datetime (UTC) |


πŸ’° Check SMS Balance

$balance = $SMS->getBalance();

πŸ‘€ Get Account Profile

$profile = $SMS->getProfile();

🧩 Laravel Service Configuration (Optional)

Add to config/services.php:

'textlk' => [
    'api_key' => env('TEXTLK_API_KEY'),
],

πŸ” Security Notes

  • Never commit your API key to GitHub
  • Always store credentials in .env
  • Use HTTPS when calling APIs

πŸ§‘β€πŸ’» Support


πŸ“„ License

MIT License Β© Text.lk

Comments