---
title: "Codels Sms Php — Project Dossier | Isaac Machakata | Isaac Machakata"
description: "PHP wrapper for 2waychat.com bulk sms by sms.codel.tech"
canonical_url: "https://isaac.co.zw/projects/codels-sms-php"
meta:
  author: "Isaac Munyaradzi Machakata"
  "og:description": "PHP wrapper for 2waychat.com bulk sms by sms.codel.tech"
  "og:image": "https://isaac.co.zw/_og/s/o_60e5877f1f0a1658.png"
  "og:image:alt": "Codels Sms Php — Project Dossier | Isaac Machakata"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Codels Sms Php — Project Dossier | Isaac Machakata"
  "twitter:description": "PHP wrapper for 2waychat.com bulk sms by sms.codel.tech"
  "twitter:image": "https://isaac.co.zw/_og/s/o_60e5877f1f0a1658.png"
  "twitter:image:alt": "Codels Sms Php — Project Dossier | Isaac Machakata"
  "twitter:title": "Codels Sms Php — Project Dossier | Isaac Machakata"
---

> Index of every page on this site: [llms.txt](https://isaac.co.zw/llms.txt)

[← Curriculum Vitae](https://isaac.co.zw/#projects)/ [ Projects](https://isaac.co.zw/projects) /#CodelsSmsPhp

**open-source** Public Repo active ★ 2

# **Codels Sms Php**

Codename: **#CodelsSmsPhp** · Repository: **immachakata/codels-sms-php**

[Visit Live Deployment (packagist.org/packages/immachakata/codelsms)](https://packagist.org/packages/immachakata/codelsms) [View on GitHub](https://github.com/immachakata/codels-sms-php)

Primary Language**PHP**

Last Updated**Nov 12, 2026**

Created**Jul 5, 2024**

Branch / Size**main · 120 KB**

## **Executive Summary **

PHP wrapper for 2waychat.com bulk sms by sms.codel.tech

## **GitHub Codebase Language Breakdown **

**PHP**95%

**Nix**5%

## **Repository Documentation (README.md) **

Fetched from GitHub

# Codel SMS PHP Wrapper

[Permalink: Codel SMS PHP Wrapper](#codel-sms-php-wrapper)

[![CI Test Package](https://github.com/immachakata/codels-sms-php/actions/workflows/ci-test.yml/badge.svg)](https://github.com/immachakata/codels-sms-php/actions/workflows/ci-test.yml) [![Packagist Version](https://camo.githubusercontent.com/4fbc685644ec07f87eef74ce98e8d0bfde7a12e5af9c652709ebc247eb6f4cee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6d616368616b6174612f636f64656c736d73)](https://camo.githubusercontent.com/4fbc685644ec07f87eef74ce98e8d0bfde7a12e5af9c652709ebc247eb6f4cee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6d616368616b6174612f636f64656c736d73) [![Packagist Downloads](https://camo.githubusercontent.com/e4aef9466fa8566e626ddae48d69514b0e194796ede93a3514decd9aaf0de65b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6d616368616b6174612f636f64656c736d73)](https://camo.githubusercontent.com/e4aef9466fa8566e626ddae48d69514b0e194796ede93a3514decd9aaf0de65b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6d616368616b6174612f636f64656c736d73) [![Packagist License](https://camo.githubusercontent.com/5f0b94f377f2e6d095c84d460245242884f95121a797560ddd9d7854ae5859f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696d6d616368616b6174612f636f64656c736d73)](https://camo.githubusercontent.com/5f0b94f377f2e6d095c84d460245242884f95121a797560ddd9d7854ae5859f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696d6d616368616b6174612f636f64656c736d73)

This is an **unofficial** package for the [codel](https://sms.codel.tech) bulk sms (also known as [2waychat.com](https://2waychat.com)) designed to make sending bulk SMS messages from your PHP applications simple and efficient.

## How It Works

[Permalink: How It Works](#how-it-works)

This wrapper interacts with the core [Codel Sms API](https://2waychat.com) and has been updated to match the March 2025 api documentation update.

It is built on top of Guzzle, a popular PHP HTTP client, to handle all communication with the Codel SMS API and provides a simple, expressive API for sending single and bulk SMS messages.

- **`Client` Class:** This is the main entry point of the library. You instantiate it with your API token, and it handles all the interactions with the Codel SMS API.
- **`Sms` Class:** A data object that represents a single SMS message, containing the destination phone number and the message text.
- **`Response` Class:** A wrapper around the Guzzle response object that provides convenient methods for accessing the response data.
- **Mocking for Tests:** The test suite uses `MockHandler` from Guzzle to simulate API calls. This ensures that your tests run quickly and do not consume your SMS credits.

## Installation

[Permalink: Installation](#installation)

You can install the package via Composer:

```
composer require immachakata/codelsms
```

## Usage

[Permalink: Usage](#usage)

First, instantiate the `Client` class with your Codel SMS API token.

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

use IsaacMachakata\CodelSms\Client;

$apiToken = 'YOUR_API_TOKEN';
$client = new Client($apiToken);
```

### Sending a Single SMS

[Permalink: Sending a Single SMS](#sending-a-single-sms)

To send a message to a single recipient, use the `send` method:

```
$response = $client->send('263771000001', 'Hello, this is a test message!');

if ($response->isOk()) {
    echo "Message sent successfully!";
}
```

You can also use the older method

```
$sms = Sms::new('263771000001', 'Hello, this is a test message!');
$response = $client->send($sms);
```

### Sending Bulk SMS

[Permalink: Sending Bulk SMS](#sending-bulk-sms)

To send the same message to multiple recipients, you can pass an array of phone numbers or a comma-separated string of phone numbers, and an array of messages either indexed by phone number, or by index. Passing a string will result in all the users receiving the same message. The easiest way though would be using the `Sms` class (or whatever you'd prefer).

> **NB**: A sender id is required when sending multiple messages and an exception will be thrown if one is not provided.

**Using the `Sms` class:**

```
$response = $client->send([
    Sms::new('2637710000001', 'Message for user #1'),
    Sms::new('2637710000002', 'Message for user #2'),
]);
```

While you can specify the timestamp at which you would want the message delivered, it hasn't seemed to work when I tried it, so I'd recommend you to send your messages exactly when you want them delivered.

**Using an array:**

For this method, you can pass in an array of receivers along with either a string of the message you want them to receive, or any array with the messages you want each to receive.

```
$phoneNumbers = ['263771000001', '263772000002', '263773000003'];
$response = $client->send($phoneNumbers, 'This is a bulk message to everyone.');
```

**Using a comma-separated string:**

```
$phoneNumbers = '263771000001,263772000002,263773000003';
$response = $client->send($phoneNumbers, 'This is a bulk message to everyone.');
```

### Sending Personalized Messages in Bulk

[Permalink: Sending Personalized Messages in Bulk](#sending-personalized-messages-in-bulk)

For more advanced use cases, you can send different messages to different recipients in a single API call. Use the `personalize` method to define a template for your messages. The callback receives the phone number and should return either an `Sms` object or a string - which is the message.

```
use IsaacMachakata\CodelSms\Sms;

$users = [
    '263771000001' => ['name' => 'John', 'bill' => 150.75],
    '263772000002' => ['name' => 'Jane', 'bill' => 200.00],
];

$phoneNumbers = array_keys($users);

// the message parameter is also passed here too to the callback function
$client->personalize(function ($receiver, $data) {
    return Sms::new("Dear {$data['name']}, your bill of \${$data['bill']} is due.");
});

// The message parameter can be skipped here
$response = $client->send($phoneNumbers, $users);
```

### Setting a Sender ID

[Permalink: Setting a Sender ID](#setting-a-sender-id)

You can specify a custom sender ID for your messages. This can be a name or a number.

```
$txt = Sms::new('263771000001', 'Message from SenderId.');
$response = $client->from('SenderId')->send($txt);
```

You can also set the sender ID directly in the constructor:

```
$client = new Client($apiToken, 'SenderId');
$response = $client->send('263771000001', 'Message from SenderId.');
```

### Checking Your Balance

[Permalink: Checking Your Balance](#checking-your-balance)

To check your remaining SMS credits, use the `getBalance` method:

```
$balance = $client->getBalance();
echo "You have {$balance} SMS credits remaining.";
```

## Testing

[Permalink: Testing](#testing)

The package includes a comprehensive PHPUnit test suite. To maintain the integrity of your account, the tests are designed to run with mock data and will not make any real API calls.

To run the tests, execute the following command in your terminal:

```
./vendor/bin/phpunit
```

## Contributing

[Permalink: Contributing](#contributing)

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

1. Fork the Project
2. Create your Feature Branch ( `git checkout -b feature/AmazingFeature`)
3. Commit your Changes ( `git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch ( `git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

[Permalink: License](#license)

Distributed under the MIT License. See `LICENSE` for more information.

## Author

[Permalink: Author](#author)

- **[Isaac Machakata](https://github.com/immachakata)** - PHP Developer

## **Recent Repository Commits **

`c15cb77`fix: convert guzzle request method to uppercase for Guzzle 8+

Nov 12, 2026

`7d3ed66`docs: update sender id and usage of Sms class for bulk sms

Dec 26, 2025

`1abbf71`docs: update sender id documentation

Dec 26, 2025

`b1ce2bd`refactor: correctly assign receivers number for bulk sms'

Dec 26, 2025

`c95a181`chore(refactor): check if each sms has a destination

Dec 26, 2025

### **Stack & Repository Topics **

**PHP** #2waychat-sms #bulk-sms #codel-sms #php-wrapper #portfolio #sdk #sms-api

## **Related Work & Projects **

[All projects →](https://isaac.co.zw/projects)

### [Ci4 Facades – PHP](https://isaac.co.zw/projects/ci4-facades)

★ 1

[packagist.org/packages/immachakata/ci4-facades](https://packagist.org/packages/immachakata/ci4-facades "https://packagist.org/packages/immachakata/ci4-facades")

A lightweight PHP package for CodeIgniter 4 that brings clean, expressive, Laravel-like traits and facades to your project—starting with database migrations and logging

#codeigniter4 #codeigniter4-library #oss

### [Ci4 Relationships – PHP](https://isaac.co.zw/projects/ci4-relationships)

★ 3

[packagist.org/packages/immachakata/ci4-relationships](https://packagist.org/packages/immachakata/ci4-relationships "https://packagist.org/packages/immachakata/ci4-relationships")

Simple nested model relations for CodeIgniter 4 framework

#oss #portfolio

### [Free For.dev – HTML](https://isaac.co.zw/projects/free-for-dev)

[github.com/ripienaar/free-for-dev/pulls?q=is%3Apr+author%3Aimmachakata](https://github.com/ripienaar/free-for-dev/pulls?q=is%3Apr+author%3Aimmachakata "https://github.com/ripienaar/free-for-dev/pulls?q=is%3Apr+author%3Aimmachakata")

A list of SaaS, PaaS and IaaS offerings that have free tiers of interest to devops and infradev

#contribution #oss #portfolio

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://isaac.co.zw/#website","@type":"WebSite","name":"Isaac Machakata","url":"https://isaac.co.zw/"},{"@id":"https://isaac.co.zw/projects/codels-sms-php#webpage","@type":"WebPage","description":"PHP wrapper for 2waychat.com bulk sms by sms.codel.tech","name":"Codels Sms Php — Project Dossier | Isaac Machakata","url":"https://isaac.co.zw/projects/codels-sms-php","isPartOf":{"@id":"https://isaac.co.zw/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://isaac.co.zw/projects/codels-sms-php"]}]}]}
```

## Sitemap

See the full [sitemap](https://isaac.co.zw/sitemap.md) for all pages.
