1. Go to this page and download the library: Download amelia/monzo-php 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/ */
amelia / monzo-php example snippets
namespace App;
use Amelia\Monzo\MonzoCredentials;
use Amelia\Monzo\Contracts\HasMonzoCredentials;
use Illuminate\Database\Eloquent\Model;
class User extends Model implements HasMonzoCredentials
{
use MonzoCredentials;
}
use Amelia\Monzo\MonzoCredentials;
use Amelia\Monzo\Contracts\HasMonzoCredentials;
class User implements HasMonzoCredentials {
use MonzoCredentials;
protected function getMonzoAccessTokenColumn()
{
return 'monzo_access_token';
}
protected function getMonzoRefreshTokenColumn()
{
return 'monzo_refresh_token';
}
protected function getMonzoUserIdColumn()
{
return 'monzo_user_id';
}
}
$client = new Amelia\Monzo\Client(
new GuzzleHttp\Client,
getenv('MONZO_CLIENT_ID') ?: null,
getenv('MONZO_CLIENT_SECRET') ?: null
);
$monzo = new Amelia\Monzo\Monzo($client);
// Amelia\Monzo\Monzo::setAccessToken($token) for single user mode
$user = User::findOrFail($id);
// will query accounts first, then use the default to query transactions.
$transactions = $monzo->as($user)->transactions();