openpesa / pesa
Pesa PHP SDK
Installs: 1 081
Dependents: 2
Suggesters: 0
Security: 0
Stars: 27
Watchers: 8
Forks: 18
Open Issues: 3
Requires
- php: ^7.2|^8.0
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^6.0|^7.4
- phpseclib/phpseclib: ~3.0
Requires (Dev)
- phpunit/phpunit: ^8.5|^9.5
README
Pesa SDK for PHP
Version 2 | Work in Progress 🚧
The Pesa SDK for PHP makes it easy for developers to access OpenAPI in their PHP code, and build robust applications and software using services like Customber 2 Bussiness, Query etc.
Documentation
Take a look at the API docs here.
Getting Started
-
Sign up for OpenAPI Portal – Before you begin, you need to sign up for an account and retrieve your credentials.
-
Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 7.1.
-
Install the SDK – Using [Composer] is the recommended way to install the Pesa SDK for PHP. The SDK is available via [Packagist] under the
openpesa/php-pesa
package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:composer require openpesa/pesa
Please see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means.
-
Using the SDK – The best way to become familiar with how to use the SDK is to read the User Guide.
Usage
Quick Examples
require 'vendor/autoload.php'; use Openpesa\SDK\Pesa; // Intiate with credentials $pesa = new Pesa([ 'api_key' => 'YOUR_API_KEY', 'public_key' => 'PUBLIC_KEY', 'client_options' => [], ],'sandbox'); // Setup the transaction $data = [ 'input_Amount' => '10000', 'input_Country' => 'TZN', 'input_Currency' => 'TZS', 'input_CustomerMSISDN' => '255766303775', 'input_ServiceProviderCode' => '000000', 'input_ThirdPartyConversationID' => 'rerekf', 'input_TransactionReference' => rand(), 'input_PurchasedItemsDesc' => 'Test Two Item' ]; // Execute $result = $pesa->c2b($data); // Print results var_dump($result);
For more example check pesa-demo-example.
Testing
composer test
Opening Issues
If you have a feature requrest or you encounter a bug, please file an issue on our issue tracker on GitHub.
Resources
- User Guide – For both getting started and in-depth SDK usage information
- API Docs – For details about operations, parameters, and responses
- Blog – Tips & tricks, articles, and announcements
- Sample Project - A quick, sample project to help get you started
- Issues – Report issues, submit pull requests, and get involved
- @openpesa – Follow us on Twitter
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please review our CONTRIBUTING for details.
Security
If you discover any security related issues, please email alphaolomi@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.