PHPackages                             silali/laravel-daraja - 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. silali/laravel-daraja

ActiveLibrary[API Development](/categories/api)

silali/laravel-daraja
=====================

A laravel package for the Safaricom Daraja APIs. Updating stanerz package to php 8.0

v4.0.0(5y ago)0745MITPHPPHP ^7.3

Since Mar 23Pushed 4y agoCompare

[ Source](https://github.com/gissilali/laravel-daraja)[ Packagist](https://packagist.org/packages/silali/laravel-daraja)[ RSS](/packages/silali-laravel-daraja/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (11)Used By (0)

Laravel Daraja
==============

[](#laravel-daraja)

[![styleci](https://camo.githubusercontent.com/552d809336103137c1d7f108eb66c416b4deb7428ce56b2fe678a4e5010a32b9/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132363337363437382f736869656c64)](https://styleci.io/repos/126376478)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/390097903de1eeaf6edb31f80291595a71be055787da3c3409708fe9eb877472/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f737461726e65727a2f6c61726176656c2d646172616a612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/starnerz/laravel-daraja/?branch=master)[![Packagist](https://camo.githubusercontent.com/a4bc754a7701acae0cd0f48ce166bf9fc63339567d23b9b9481d85ecad84c707/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737461726e65727a2f6c61726176656c2d646172616a612e737667)](https://packagist.org/packages/starnerz/laravel-daraja)[![Packagist](https://camo.githubusercontent.com/718668ff5d687708ad74aa803e4e84972705ae05e7b0cde58596af4a75938f9e/68747470733a2f2f706f7365722e707567782e6f72672f737461726e65727a2f6c61726176656c2d646172616a612f642f746f74616c2e737667)](https://packagist.org/packages/starnerz/laravel-daraja)[![Packagist](https://camo.githubusercontent.com/c8a05d1dde4996cb80ab8acabb93b404375b19230ca1cf7464126f2afdad70aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737461726e65727a2f6c61726176656c2d646172616a612e737667)](https://packagist.org/packages/starnerz/laravel-daraja)

This package provides you with a simple tool to make requests to Safaricom Daraja APIs so that you can focus on the development of your awesome applications instead of all the set up involved.

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

[](#installation)

Install via composer

```
composer require starnerz/laravel-daraja
```

### Register Service Provider

[](#register-service-provider)

**Note! This and next step are optional if you use laravel&gt;=5.5 with package auto discovery feature.**

Add service provider to `config/app.php` in `providers` section

```
Starnerz\LaravelDaraja\LaravelDarajaServiceProvider::class,
```

### Register Facade

[](#register-facade)

Register package facade in `config/app.php` in `aliases` section

```
Starnerz\LaravelDaraja\Facades\MpesaApi::class,
```

### Publish Configuration File

[](#publish-configuration-file)

```
php artisan vendor:publish --provider="Starnerz\LaravelDaraja\LaravelDarajaServiceProvider" --tag="config"
```

Fill in all the details you will be requiring for your application. Here are the env variables for quick copy paste.

```
DARAJA_CONSUMER_KEY=
DARAJA_CONSUMER_SECRET=

DARAJA_INITIATOR_NAME=
DARAJA_INITIATOR_CREDENTIAL=
DARAJA_INITIATOR_SHORTCODE=

DARAJA_STK_SHORTCODE=
DARAJA_STK_PASS_KEY=

```

Usage
-----

[](#usage)

If you have not created your Safaricom API application yet you can create one at [Safaricom Developer](https://developer.safaricom.co.ke/)

Each Safaricom API except Oauth has been implemented as a class on its own which you can use in your code.

```
$STK = new STK();
$STK->push('254727123456','10000','New Purchase','R3F3R3NC3');
```

If you prefer using the facade

```
MpesaApi::STK()->push('254727123456','10000','New Purchase','R3F3R3NC3');
```

If you will be using the C2B Api you can easily register the validation and confirmation URLs through artisan.

```
# php artisan daraja:register-urls
```

Security
--------

[](#security)

If you discover any security related issues, please email instead of using the issue tracker.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 87.1% 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 ~129 days

Recently: every ~157 days

Total

8

Last Release

2070d ago

Major Versions

v1.0.4 → v2.0.02020-09-10

v2.0.0 → v3.0.02020-09-10

v3.0.0 → v4.0.02020-09-10

PHP version history (3 changes)v1.0.0PHP &gt;=5.6

v2.0.0PHP ^7.2

v4.0.0PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f4baf0ec06e062cbcced7e83d784a46400afe025d3d8b1ef615b0db1f33b70d?d=identicon)[silali](/maintainers/silali)

---

Top Contributors

[![starnerz](https://avatars.githubusercontent.com/u/15049451?v=4)](https://github.com/starnerz "starnerz (27 commits)")[![gissilali](https://avatars.githubusercontent.com/u/13868653?v=4)](https://github.com/gissilali "gissilali (2 commits)")[![edlugz](https://avatars.githubusercontent.com/u/4479919?v=4)](https://github.com/edlugz "edlugz (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravelmpesampesa-apidaraja

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silali-laravel-daraja/health.svg)

```
[![Health](https://phpackages.com/badges/silali-laravel-daraja/health.svg)](https://phpackages.com/packages/silali-laravel-daraja)
```

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)

PHPackages © 2026

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