PHP code example of karson / mpesa-php-sdk

1. Go to this page and download the library: Download karson/mpesa-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

karson / mpesa-php-sdk example snippets

bash
composer 
 php
// Set the api, public key, provider and environment secret as follows in your .env file

MPESA_API_KEY ="Your API Key";
MPESA_PUBLIC_KEY='You Public Key'
MPESA_ENV='test' // 'live' production environment
MPESA_SERVICE_PROVIDER_CODE=171717