PHPackages                             begenius/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. begenius/laravel-ussd

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

begenius/laravel-ussd
=====================

A Laravel package to build scalable USSD applications and workflows.

v1.0.0(1mo ago)06MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Jul 10Pushed 1mo agoCompare

[ Source](https://github.com/BeGenius-Innovator/laravel-ussd)[ Packagist](https://packagist.org/packages/begenius/laravel-ussd)[ RSS](/packages/begenius-laravel-ussd/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Laravel USSD
============

[](#laravel-ussd)

[![Latest Version](https://camo.githubusercontent.com/72d0c20c3c17d6334430699a4b1132397f2d9b7f48ab518245a2880127c3786d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626567656e6975732f6c61726176656c2d757373642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/begenius/laravel-ussd)[![MIT License](https://camo.githubusercontent.com/6d61e9ff7bc856dadcc27eeb059e61f9bcba02769896259f9b8c993e47665595/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626567656e6975732f6c61726176656c2d757373642e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/e26f6af5363f4c36a18664d33289ea2e7bd6b706440e7600303a17d5a428b8da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626567656e6975732f6c61726176656c2d757373642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/begenius/laravel-ussd)[![Tests](https://github.com/begenius/laravel-ussd/actions/workflows/tests.yml/badge.svg)](https://github.com/begenius/laravel-ussd/actions/workflows/tests.yml)

Build production-grade USSD applications in Laravel.

**laravel-ussd** is a framework-agnostic USSD engine that lets you create telecom-grade USSD services with a clean, declarative API. It supports multiple gateways (Orange, Moov, Africa's Talking, Infobip, etc.) through a driver-based architecture.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Presentation](#presentation)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
- [Menus](#menus)
- [Flows](#flows)
- [Actions](#actions)
- [Sessions](#sessions)
- [Drivers](#drivers)
- [Simulator](#simulator)
- [Testing](#testing)
- [Architecture](#architecture)
- [Contributing](#contributing)
- [Roadmap](#roadmap)

---

Presentation
------------

[](#presentation)

### What is USSD?

[](#what-is-ussd)

USSD (Unstructured Supplementary Service Data) is a protocol used by GSM phones to communicate with service providers. It's the technology behind `*123#` codes — used for mobile money, balance checks, and telecom services across Africa and beyond.

### What this package does

[](#what-this-package-does)

This package provides a complete framework for building USSD services:

- **Menu system** — Declarative, tree-based navigation
- **Flow engine** — Multi-step workflows with state machine
- **Session management** — Database, Redis, or in-memory storage
- **11 gateway drivers** — Orange, Moov, Africa's Talking, Infobip, Twilio, Beem, Advanta, Hubtel, MTN, Vodacom, Airtel
- **Rate limiting** — Per phone number throttling with END 429 response
- **Multi-language** — Built-in EN/FR with easy extensibility
- **Validation** — Input validation per flow step
- **Logging** — Request/response logging
- **Simulator** — Web-based testing tool
- **Artisan commands** — `ussd:list` and `ussd:clean`
- **Error handling** — Graceful error recovery

### Architecture overview

[](#architecture-overview)

```
                    ┌──────────────────┐
                    │     Telephone    │
                    └────────┬─────────┘
                             │ USSD
                    ┌────────▼─────────┐
                    │  USSD Gateway    │
                    │(Orange, Moov, AT)│
                    └────────┬─────────┘
                             │ HTTP POST
                    ┌────────▼─────────┐
                    │  UssdController  │
                    └────────┬─────────┘
                             │
                    ┌────────▼─────────┐
                    │   UssdEngine     │
                    │  (Orchestrator)  │
                    └──┬────┬────┬─────┘
                       │    │    │
              ┌────────┘    │    └────────┐
              ▼             ▼             ▼
        ┌─────────┐ ┌──────────┐ ┌──────────┐
        │ Session │ │   Menu   │ │   Flow   │
        │ Manager │ │  Manager │ │  Engine  │
        └─────────┘ └──────────┘ └──────────┘

```

---

Installation
------------

[](#installation)

```
composer require begenius/laravel-ussd
```

Laravel will auto-discover the service provider. If you're using Laravel &lt; 5.5, add this to `config/app.php`:

```
'providers' => [
    BeGenius\Ussd\UssdServiceProvider::class,
],
```

### Publish configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=ussd-config
```

### Run migrations

[](#run-migrations)

```
php artisan vendor:publish --tag=ussd-migrations
php artisan migrate
```

---

Configuration
-------------

[](#configuration)

Configure the package in `config/ussd.php` or via environment variables:

```
USSD_DRIVER=default
USSD_SESSION_DRIVER=database
USSD_SESSION_LIFETIME=2
USSD_REDIS_CONNECTION=default
USSD_ROUTES_PREFIX=ussd
USSD_SIMULATOR_ENABLED=false
USSD_LOGGING_ENABLED=true
```

OptionDefaultDescription`default_driver``default`USSD gateway driver`session_driver``database`Session storage driver (`database`, `redis`, `array`)`session_lifetime``2`Session timeout (minutes)`redis_connection``default`Redis connection name for `redis` session driver`session_table``ussd_sessions`Database table name`routes_prefix``ussd`URL prefix for USSD routes`default_menu``welcome`Initial menu name`max_input_length``182`Max input characters`simulator_enabled``false`Enable web simulator---

Quick Start
-----------

[](#quick-start)

### 1. Define menus in a Service Provider

[](#1-define-menus-in-a-service-provider)

```
