mnpy/mnpy-laravel

Laravel wrapper for the PHP API SDK of MNPY.

Downloads

10

Stars

0

Version

v0.1.0

MNPY SDK Laravel Wrapper

Laravel 5 wrapper around the MNPY SDK

Requirements

  • PHP >= 7.0
  • A MNPY account

Installation

Add the package to the requirements of your composer file.

composer require mnpy/mnpy-laravel

Add the Service Provider to your config/app.php (not applicable for Laravel 5.5 and higher)

MNPY\Laravel\MNPYServiceProvider::class

If you wish to use Facades instead of Dependency Injection you should add the following to your config/app.php file.

'MNPYTransaction' => MNPY\Laravel\Facades\MNPYTransaction::class,
'MNPYPrice' => MNPY\Laravel\Facades\MNPYPrice::class
'MNPYToken' => MNPY\Laravel\Facades\MNPYToken::class

Now publish the config (or add MNPY_API_KEY to your .env file)

php artisan vendor:publish --provider="MNPY\Laravel\MNPYServiceProvider"

Usage

This package serves as wrapper for mnpy/mnpy-php-api-sdk. Please refer to the original package for documentation regarding usage.


Depency Injection

use MNPY\SDK\Transaction;

class Foo {
    protected $transaction;

    public function __construct(Transaction $transaction) {
        $this->transaction = $transaction;
    }
    
    public function bar($transaction_id) {
        return $this->transaction->get($transaction_id);
    }
}

Facades

use MNPY\Laravel\Facades\MNPYTransaction;

class Foo {
    protected $transaction;

    public function bar($transaction_id) {
        return MNPYTransaction::get($transaction_id);
    }
}