PHP code example of cviebrock / laravel-mangopay

1. Go to this page and download the library: Download cviebrock/laravel-mangopay 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/ */

    

cviebrock / laravel-mangopay example snippets


    $app->configure('mangopay');

    $app->register(Cviebrock\LaravelMangopay\ServiceProvider::class);
    

'mangopay' => [
    'env'    => env('MANGOPAY_ENV', 'sandbox'),  // or "production"
    'key'    => env('MANGOPAY_KEY'),             // your Mangopay client ID
    'secret' => env('MANGOPAY_SECRET'),          // your Mangopay client password
],

class MyController extends Illuminate\Routing\Controller
{

    /**
     * @var \MangoPay\MangoPayApi
     */
    private $mangopay;
    
    public function __construct(\MangoPay\MangoPayApi $mangopay) {
        $this->mangopay = $mangopay;
    }

    public function doStuff($someId)
    {
        // get some user by id
        $john = $this->mangopay->Users->Get($someId);

        // change and update some of his data
        $john->LastName .= " - CHANGED";
        $this->mangopay->Users->Update($john);

        // get his bank accounts
        $pagination = new MangoPay\Pagination(1, 10); // get 1st page, 10 items per page
        $accounts = $this->mangopay->Users->GetBankAccounts($john->Id, $pagination);

        // etc.
    }
}
sh
    php artisan vendor:publish --provider="Cviebrock\LaravelMangopay\ServiceProvider"
    
sh
    php artisan mangopay:mkdir  
    
sh
    php artisan mangopay:mkdir