dash8x/rm-laravel

Laravel wrapper for Revenue Monster PHP SDK

v1.1.0 2024-10-20 15:47 UTC

This package is auto-updated.

Last update: 2024-11-20 15:59:29 UTC


README

Latest Version on Packagist Test Status Code Coverage Badge Total Downloads

Laravel wrapper for Revenue Monster PHP SDK.

Installation

You can install the package via composer:

composer require dash8x/rm-laravel

Optionally you can use the Facade for shorter code. Add this to your facades:

'RevenueMonster' => Dash8x\RevenueMonster\Facades\RevenueMonsterFacade::class;

Setting up the Revenue Monster credentials

Add your Revenue Monster Client ID and Client Secret to your config/services.php. You can refer to how to create the API Client from the Official Revenue Monster Documentation.

Make sure to add the private key file to gitignore if you've it in the project directory.

// config/services.php
...
'rm' => [
    'client_id' => env('RM_CLIENT_ID'), // Client ID 
    'client_secret' => env('RM_CLIENT_SECRET'), // Client Secret
    'sandbox' => env('RM_SANDBOX', false), // Whether to use the sandbox mode
    'private_key' => base_path('/rm-private-key.pem'), // Path to the private key file                           
],
...

Usage

Using the App container:

$rm = App::make('rm');

// Get merchant profile
try {
  $response = $rm->merchant->profile();
} catch(ApiException $e) {
  echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
  echo $e->getMessage();
}

Using the Facade

// Get merchant profile
try {
  $response = RevenueMonster::merchant()->profile();
} catch(ApiException $e) {
  echo "statusCode : {$e->getCode()}, errorCode : {$e->getErrorCode()}, errorMessage : {$e->getMessage()}";
} catch(Exception $e) {
  echo $e->getMessage();
}

Available Methods

Refer to the readme for the Official PHP SDK.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.