Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ameliaikeda/monzo-php
PHP Library for use with https://monzo.com
https://github.com/ameliaikeda/monzo-php
api api-client laravel monzo php socialite
Last synced: 30 days ago
JSON representation
PHP Library for use with https://monzo.com
- Host: GitHub
- URL: https://github.com/ameliaikeda/monzo-php
- Owner: ameliaikeda
- License: bsd-3-clause
- Archived: true
- Created: 2017-02-22T20:29:04.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T22:45:46.000Z (over 6 years ago)
- Last Synced: 2024-08-03T18:19:25.221Z (4 months ago)
- Topics: api, api-client, laravel, monzo, php, socialite
- Language: PHP
- Size: 129 KB
- Stars: 21
- Watchers: 4
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-monzo - monzo-php - An API client for Monzo Bank (with a Laravel service provider) (Code & Client Libraries)
README
Monzo PHP Client
This library allows access to the Monzo API in PHP. This library requires PHP 7.1+.
## Installation
```
composer require amelia/monzo-php
```If you don't already have your own access tokens from completing oauth yourself, you'll need to also `composer require laravel/socialite`.
You should set the following variables in your `.env` (or otherwise):
- `MONZO_CLIENT_ID`
- `MONZO_CLIENT_SECRET`
- `MONZO_REDIRECT_URI`You can create an application at [https://developers.monzo.com](https://developers.monzo.com).
## Laravel integration
`Amelia\Monzo\MonzoServiceProvider::class` is registered automatically in Laravel 5.5.
A future version of this package will include automatic webhook handling per-user, and full automatic socialite integration.
The environment variables that control these will be:
- `MONZO_WEBHOOKS=true`
- `MONZO_SOCIALITE=true`### Socialite integration
To automatically add callbacks for socialite, this package provides an optional authentication system.
> **Caveat**
> This assumes you are adding existing users to an app on monzo.
> If you are not doing this, you'll need to set up your own routes to create/manage users based on API responses from socialite.First, add the `MonzoCredentials` trait to your `Authenticatable` user model.
```php
as($user)->accounts();
```### Grab the last 100 transactions for a user account
```php
as($user)->transactions('acc_12341243');
```### Grab the last 100 transactions for a user's default account
```php
as($user)->transactions();
```### Grab a paginator instance for a user's transactions
```php
as($user)->paginate(50)->transactions('acc_12341243');
```### Expand (and hydrate) relations in the API
```php
as($user)
->paginate(50)
->expand('account')
->transactions('acc_12341243');
```### See a user's balance
```php
as($user)->balance();
```