Skip to content
Mizani by eazysoft
Documentation

Install Mizani and keep it running.

Everything you need to go from a licence to a working panel at /mizani. Read this before booking a support consultation: most answers are here.

Requirements

  • A Laravel 12 or 13 application on PHP 8.3 or later.
  • M-Pesa through starnerz/laravel-daraja 5.5 or later. Mizani reads the traffic Laravel Daraja already sends and receives.
  • The Laravel scheduler running, for the commands in Scheduled commands below.
  • For statement import only: pdftotext from Poppler (apt install poppler-utils). Without it, everything else works.

There is no npm package, no Vite entry and no published asset: the panel ships its own compiled styles.

Install

1. Point Composer at the repository. After you buy, your account page shows the repository address with your own username and token. Add the repository to your application's composer.json:

"repositories": [
    {"type": "composer", "url": "https://mizani.eazysoft.africa/composer"}
]

Store the token where Composer finds it, not in your repository. In CI, set COMPOSER_AUTH instead.

composer config --global --auth http-basic.mizani.eazysoft.africa <username> <token>

2. Require the panel and the M-Pesa driver, then migrate. The ledger, which records every payment, comes with them; its migrations load automatically.

composer require mizani/panel mizani/mpesa
php artisan migrate

3. Open the gate (next section), then visit /mizani. Until the first payment is recorded, the overview is a checklist: tables, driver, configuration, schedule, and a sandbox payment that proves the whole path. It disappears with the first recorded row.

Publish the configuration only to change something, and the views only to change how they look:

php artisan vendor:publish --tag=mizani-panel-config
php artisan vendor:publish --tag=mizani-panel-views

Who gets in

Mizani has no users and no login of its own. A gate over your application's own users decides who may open the panel. Define it in a service provider:

Gate::define('viewMizaniPanel', fn ($user) => $user->isAdmin());

Until it is defined, the panel is closed to everybody. Removing somebody from your application removes them from the panel.

The panel mounts at /mizani. Change route.prefix, route.middleware or route.domain in the published config to move it, add middleware, or serve it from its own subdomain.

People and abilities

The gate decides who gets in. Buttons that move money have a second, narrower layer: six abilities. It is off until you set permissions.enforce, so upgrading takes away nobody's button.

AbilityLets somebody
resolveClear payments off the attention list.
replaySend a stored callback through the application again.
importWrite payments the provider has and you do not into the ledger.
balanceAsk the provider for a fresh float figure (metered, usually billed).
see-balancesSee the float: the Balances screen and the figure in the header.
manageGrant and revoke all of the above, for anybody.

Turning enforcement on locks everybody out until somebody is let in, so the first grant comes from a terminal. After that, the People screen does the same with checkboxes. --can sets the whole list; every change is audited.

php artisan mizani:people 1 --label="Wanjiru" --can=manage --can=resolve
php artisan mizani:people                      # who may do what
php artisan mizani:people 1 --can=none         # take it all back

An application that already has roles can define mizani.resolve, mizani.replay and the rest as gates of its own; those win.

Scheduled commands

Add these to your scheduler. mizani:reconcile, mizani:doctor and mizani:status exit non-zero when something needs a person, so you can alert on them instead of reading them.

Schedule::command('mizani:watch')->everyFiveMinutes();
Schedule::command('mizani:sweep')->everyFiveMinutes();
Schedule::command('mizani:reconcile')->hourly();
Schedule::command('mizani:balance --check')->hourly();
Schedule::command('mizani:prune')->daily();

mizani:watch emails you when callbacks stop arriving; see When callbacks stop. mizani:sweep asks Safaricom about STK prompts that never concluded. mizani:reconcile compares Safaricom's record with yours; add --import to close the gap. Balance requests are asynchronous: the figure arrives on the result callback.

When callbacks stop

A paybill that takes nothing for hours can be perfectly healthy, so mizani:watch never alerts because things are quiet. It says callbacks have stopped only on evidence:

  • Prompts nobody answered. Safaricom calls back even when a customer cancels or ignores an STK prompt, so accepted prompts with no callback at all mean the callback was lost.
  • Payments that never arrived. Each paybill's Pull Transactions record is read every few minutes. Payments there that never came as a callback mean callbacks have stopped. No payments there means the paybill is simply quiet, and nothing is sent.

You get one email when callbacks stop and one when they resume, with counts, times and receipt numbers but never amounts. When several paybills stop at once, it is one email saying Safaricom is the likely cause. The outage also leads the overview and is listed on the Shortcodes screen, and the payments from the gap come in with mizani:reconcile --import.

[email protected]   # or it uses MIZANI_BALANCE_MAIL

A paybill whose Pull Transactions record cannot be read shows as can't read on the Shortcodes screen, with the reason. It is still watched through its prompts and never raises an alert. Usually it is not registered for Pull Transactions, or its credentials do not work yet. Mizani tries again every 30 minutes. Fixed the setup? Run mizani:doctor or mizani:watch --retry and the next check tries at once.

To bring the missing payments in as soon as they are found, and push them through your listeners, set MIZANI_WATCH_IMPORT=true. Otherwise they wait for you on the Reconciliation screen.

The defaults suit most paybills. Every threshold is under watch in config/mizani.php, and the ones worth knowing have their own variables:

VariableDefaultWhat it decides
MIZANI_WATCH_UNANSWERED3Unanswered prompts in the window that count as callbacks stopping, as long as they are at least half of all prompts sent.
MIZANI_WATCH_PROMPT_WINDOW15Minutes of prompts looked at, once each has had its five minutes to be answered.
MIZANI_WATCH_MISSING2Payments in Safaricom's record with no callback that count as callbacks stopping. One alone is treated as noise.
MIZANI_WATCH_LOOKBACK60Minutes of Safaricom's record read on each check.
MIZANI_WATCH_RETRY_MINUTES30How long before a record that could not be read is tried again.
MIZANI_WATCH_PROMPTS / _PAYMENTStrueTurn either check off.

Float alerts

A float that runs dry does not announce itself: payouts start failing, and the first sign is a customer asking where their money is. Give each account a floor, and mizani:balance --check, scheduled hourly, emails you when one falls below it. Publish the ledger's configuration and set the floors there:

php artisan vendor:publish --tag=mizani-config

// config/mizani.php
'balance' => [
    'thresholds' => [
        'Working Account' => 100000,
        '600123' => ['Working Account' => 5000],   // one shortcode's own floor
    ],
],
[email protected]

A floor named by account applies to that account under every shortcode, and a shortcode's own floor wins. Floors are compared with available funds, not the balance, because reserved money cannot pay anybody. An account below its floor is also on the overview's attention list. The balance result arrives on Safaricom's result callback, so that URL must be reachable.

Statement import

Safaricom's Pull Transactions only reaches back 48 hours. For anything older, download the statement PDF from the M-Pesa org portal and upload it on the Reconciliation screen.

Nothing is accepted unchecked: every row's balance must follow from the row below it, and the number of rows must match the statement's own total. A file that fails either check is refused whole. Completed payments in become c2b payments; charges, money out and incomplete rows are counted and left out. Statements need pdftotext; set MIZANI_PDFTOTEXT if it is not on the PATH. The Doctor screen says whether it was found.

Masking and export

Phone numbers and the float are covered by default, so a screen can be shared without exposing a customer's number or the balance. Uncovering a phone number is recorded in the audit log; the float is a plain toggle.

The Ledger, Requests and Callbacks screens export what they list as CSV, under the same filters and range. Covered numbers stay covered in exports, stored payloads are never exported, and every export is audited.

To start uncovered, on a screen nobody can see over your shoulder, set MIZANI_PANEL_MASK_PHONES=false or MIZANI_PANEL_MASK_BALANCES=false.

Panel settings

Everything has a sensible default. These are the ones people change:

VariableDefaultWhat it decides
MIZANI_PANEL_TIMEZONEAfrica/NairobiThe timezone every day and range is counted in, whatever the server's is.
MIZANI_PANEL_RANGElast-24-hoursThe range a screen opens on: last-hour, today, yesterday, last-7-days, this-month and the rest of the picker.
MIZANI_PANEL_FLOAT_ACCOUNTfirst recordedWhich account the figure in the header shows, when there is more than one.
MIZANI_PANEL_PREFIXmizaniWhere the panel is mounted.
MIZANI_PANEL_DOMAINnoneServe the panel from its own subdomain.

Retention

mizani:prune, scheduled daily, deletes what is past its window. Raw traffic goes first; the ledger is kept longest.

MIZANI_RETAIN_REQUESTS=30        # days of calls to Safaricom
MIZANI_RETAIN_CALLBACKS=90       # days of callbacks, and of outages that have ended
MIZANI_RETAIN_TRANSACTIONS=400   # days of payments

Some things are never pruned, however old: a payment nobody has resolved, a callback whose handler threw, an outage still going on, and the audit log. Run mizani:prune --dry-run to see what would go.

Updates and your licence

Your licence includes every version released during the twelve months after purchase. Update the usual way:

composer update "mizani/*"
php artisan migrate

Always migrate after updating: a release can add a table or a column, and the ledger's migrations load on their own. A release that needs a new scheduled command says so on the releases page. Version 1.4 of the ledger is one: add mizani:watch every five minutes, as in Scheduled commands. From panel 1.6.1 the Doctor screen can look for you: press Look for the schedule and it lists anything missing with the line that schedules it.

When the twelve months end, your token keeps working: every version released inside your window still installs, on a fresh server or in CI, and everything installed keeps running. Only versions released after your window stay out of reach until you renew from your account.

Nothing in Mizani checks a licence while it runs: no phone-home, no kill switch. The Licence and updates screen reads one public file, releases.json, which carries nothing about who asked, and only when somebody presses the button. Set MIZANI_PANEL_UPDATE_MANIFEST to host it yourself, or to null to switch checking off. Mizani never updates itself; your deploy applies updates.

Mizani Pro

Mizani Pro is for platforms that run M-Pesa for many businesses, each on its own paybill or till. Install it alongside the panel:

composer require mizani/pro
php artisan migrate

Your application tells Pro whose businesses exist and who may see them, by binding three contracts from mizani/contracts in a service provider:

  • ScopeResolver: your tenancy, as scope keys and labels.
  • GrantsScopes: who sees which businesses, and which platform staff get support and fleet. Until it is bound, everybody is granted nothing.
  • ResolvesConnections: each business's Daraja credentials and shortcodes. Or skip it and use Pro's own table.

To keep connections in Pro's table, set MIZANI_PRO_CONNECTIONS=database, migrate, and connect each business without a deploy. A bare --setting=name is asked for without echoing, so secrets stay out of your shell history.

php artisan mizani:pro:connect tenband-live --scope=tenband --shortcode=4012345 \
    --setting=mode=live --setting=consumer_key --setting=consumer_secret
php artisan mizani:pro:connections
php artisan mizani:pro:doctor --scope=tenband

Each business's staff sign in to the same panel at /mizani and see only their own business: payments, callbacks, health, shortcodes, balances if granted, and an audit trail that shows what platform support looked at and why. Platform staff get two screens of their own:

  • Fleet (/mizani/fleet, the fleet ability): every business's health, worst first. A business whose callbacks stopped comes first, and when several stop together it says Safaricom is the likely cause. Problem counts only, never balances, takings or volumes.
  • Support lookup (/mizani/support, the support ability): find one payment by receipt, phone or account reference, give a reason, and open it read-only. The business sees who looked and why. No amounts, and nothing there can replay, resolve or import.

Each payment is tied to its business when it is recorded. After you move a shortcode from one business to another, run mizani:rescope to work out every row's owner again.

Pro is for live paybills and tills only. Daraja's sandbox shares test shortcodes between apps, so a sandbox payment cannot be told apart by business. Connect a business once its own paybill or till is live.

Command reference

CommandDoes
mizani:statusWhat needs a person. Prints nothing when all is well.
mizani:doctorChecks the configuration for the things that break quietly.
mizani:reconcileCompares Safaricom's record with yours. --import closes the gap.
mizani:watchEmails once when callbacks stop arriving and once when they resume. --retry rereads every Pull Transactions record at once.
mizani:sweepAsks Safaricom about STK prompts that never concluded.
mizani:replayRe-runs callbacks whose handler threw.
mizani:resolveClears reconciled payments off the attention list once dealt with.
mizani:balanceShows the recorded float; --check asks for a fresh one.
mizani:pruneDeletes recorded traffic past its retention window.
mizani:peopleGrants and lists abilities from a terminal.
mizani:rescopeWorks out every row's business again from its shortcode. Pro.
mizani:pro:connectConnects a business's paybill or till without a deploy. Pro.
mizani:pro:connectionsLists the connections Pro keeps. Pro.
mizani:pro:doctorChecks each business's own credentials and URLs; --live asks Safaricom. Pro.

Getting help

Start with this page and with php artisan mizani:doctor, which names most configuration problems outright. If you are still stuck, book a support consultation. Consultations are billed separately from the licence.