Search by

eza / sdk

ezacloud

Eza Cloud for PHP: transactional email, PayEdge M-Pesa STK push and signed webhooks.

v0.1.0 2026-10-18 13:34 UTC

This package is auto-updated.

Last update: 2026-10-18 14:13:18 UTC


README

Transactional email, PayEdge M-Pesa STK pushes and signed webhooks. PHP 8.1 or later with curl; no other dependencies.

composer require eza/sdk

Email

On Eza, every app has EZA_EMAIL_KEY and EZA_EMAIL_URL already:

$eza = new Eza\Client();
$sent = $eza->emails()->send([
    'from' => 'Shop <orders@mail.shop.co.ke>',
    'to' => 'wanjiku@gmail.com',
    'subject' => 'Your receipt',
    'html' => '<p>Thanks for your order.</p>',
]);

Elsewhere, pass an API key with the email scope: new Eza\Client($key). Until your sending domain is verified, email only reaches members of your organisation. Laravel apps on Eza need none of this: they get the MAIL_ settings and send through SMTP with Mail::to(...).

PayEdge

$eza = new Eza\Client(getenv('EZA_API_KEY')); // the payedge scope
$tx = $eza->payedge()->stkPush([
    'phone' => '254712345678',
    'amount_kes' => 1500,
    'account_reference' => 'INV1024',
]);

Webhooks

try {
    $event = Eza\Webhook::verify(
        file_get_contents('php://input'),
        Eza\Webhook::headerFromServer(),
        getenv('EZA_WEBHOOK_SECRET'),
    );
} catch (Eza\SignatureException) {
    http_response_code(400);
    exit;
}

Errors

API errors throw Eza\EzaException with status, errorCode, requestId and fields.