PHPackages                             norris1z/hubtel-ussd - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. norris1z/hubtel-ussd

ActiveLibrary[API Development](/categories/api)

norris1z/hubtel-ussd
====================

An unofficial php library for processing Hubtel USSD requests

2.0.0(7y ago)2361MITPHPPHP &gt;=5.6.4

Since Jan 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Norris1z/hubtel-ussd-php)[ Packagist](https://packagist.org/packages/norris1z/hubtel-ussd)[ RSS](/packages/norris1z-hubtel-ussd/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Hubtel USSD
===========

[](#hubtel-ussd)

Based on [Hubtel's USSD API](https://developers.hubtel.com/documentations/ussd)

About
-----

[](#about)

This package helps you to build maintainable and scalable USSD applications by breaking down your "long switch" statement USSD application into modules

Getting Started
---------------

[](#getting-started)

Check out [this link](https://developers.hubtel.com/documentations/ussd#how-to-get-ussd-short-code) to know how you can acquire a USSD code from Hubtel.

### Installing

[](#installing)

Install the package from `composer`

```
composer require norris1z/hubtel-ussd

```

### Usage

[](#usage)

Setup a `route` to respond to all `Hubtel's` requests.

Note that `Hubtel` sends no `csrf` tokens hence disable `csrf`protection for that `route`.

For `Laravel`, add the `route` to the `except` array in the `VerifyCsrfToken` middleware.

`Hubtel\USSD\Request::class` is a class which represents the request from `Hubtel`. It has methods for all the parameters listed on `Hubtel's Documentation Page`.

View Source [Request.php](https://github.com/Norris1z/hubtel-ussd-php/blob/master/src/Hubtel/Request.php)

`Hubtel\USSD\Response::class` is a class which represents the response sent to `Hubtel`. It has methods for all the parameters listed on `Hubtel's Documentation Page`.

View Source [Response.php](https://github.com/Norris1z/hubtel-ussd-php/blob/master/src/Hubtel/Response.php)

`RequestTypes::class` has two properties, `RESPONSE` and `RELEASE` for indicating the type of response in a sequence.

```
    $response = Response::createInstance('Hello Hubtel, i want a response',RequestTypes::RESPONSE);
    $response = Response::createInstance('Hello Hubtel, end the sequence',RequestTypes::RELEASE);
```

`USSD::class` is a class with one static method `process` which takes two parameters a `Request (an instance of Hubtel\USSD\Reqeust)` and an `array` of `sequence (any class that implements the Hubtel\USSD\SequenceInterface)`;

```
     USSD::process(/** An instance of Hubtel\USSD\Request **/,[
        new Sequence1(),
        new Sequence2(),
        new Sequence3()
    ])->toArray();
```

All `seqeunces` must have implement the `SequenceInterface` and hence have a `handle` method and must return an instance of `Hubtel\USSD\Response (Response)`. The `USSD::process` method automagically injects a `Request` parameter into the `handle` method of each `sequence`. This `Request` is an instace of `Hubtel\USSD\Request` which grants access to all properties and methods in the `request`.

```
    //Sequence1.php
    use Hubtel\USSD\Request;
    use Hubtel\USSD\RequestTypes;
    use Hubtel\USSD\Response;
    use Hubtel\USSD\SequenceInterface;

    class Sequence1 implements SequenceInterface
    {

        public function handle(Request $request)
        {
            return Response::createInstance('Welcome to Freebie Service.\n1. Free Food\n2. Free Drink\n3. Free Airtime',RequestTypes::RESPONSE);
        }
    }
```

Visit [Hubtel's USSD Api documentation page](https://developers.hubtel.com/documentations/ussd-api) for the list of methods on the request and response classes

Examples
--------

[](#examples)

1. [Laravel](https://github.com/Norris1z/hubtel-ussd-php/blob/master/examples/Laravel.md)
2. [Lumen](https://github.com/Norris1z/hubtel-ussd-php/blob/master/examples/Lumen.md)

Feel free to submit pull-requests for examples with other frameworks 😊

Running the tests
-----------------

[](#running-the-tests)

`composer test`

Authors
-------

[](#authors)

- **Norris Oduro** - [Norris1z](https://github.com/Norris1z)

License
-------

[](#license)

This project is licensed under the MIT License

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~376 days

Total

2

Last Release

2659d ago

Major Versions

1.0.0 → 2.0.02019-01-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/7aa0affe014d465c40939461bbb2d175e64bedb905df2a5a980d87fcc8953631?d=identicon)[Norris1z](/maintainers/Norris1z)

---

Top Contributors

[![Norris1z](https://avatars.githubusercontent.com/u/18237132?v=4)](https://github.com/Norris1z "Norris1z (6 commits)")

---

Tags

hubtelphpussdphpussdhubtel

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/norris1z-hubtel-ussd/health.svg)

```
[![Health](https://phpackages.com/badges/norris1z-hubtel-ussd/health.svg)](https://phpackages.com/packages/norris1z-hubtel-ussd)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
