What is Brex?

Brex is a fin-tech company that offers a variety of financial products. That includes bank accounts, transfers, corporate cards, vendor management & bill pay, ERP integrations, and more.

What is this?

The Brex SDK for PHP is an installable composer package that allows an application to call on the Brex API through PHP.

Why is this?

The Brex API allows you to do specific actions, custom actions, and bulk actions on your Brex account. It is also a moderately sized application that consists of 6 different relevant endpoints that connect with a variety of entities and calls supported on each one. This SDK allows you to call any portion of that API in a PHP runtime environment in a structured and object-oriented way without worrying about REST particulars or being concerned with a particular HTTP implementation.

How does this work?

This SDK marshals access to the entire API through a single host object. We leverage code generation through Jane PHP to consume the published OpenAPI specification of Brex’s API. Additionally we’re able to use HTTPlug to allow our generated code to support an HTTP request client you may already be using through auto-discovery. Note: A default implementation of Symfony’s HTTP Client is suggested and is discussed here (PSR-7 HTTP Client), if you are not already using one.

Selected Use Cases

Pulling the Most Recent Transactions

//this returns a page <>
/** @var \NxSys\Library\Clients\Brex\API\Transactions\Client $oTransactionsClient */
$oPagedAccounts = $oTransactionsClient->listAccounts();
$oAccounts=$oPagedAccounts->getItems(); //only first 100

foreach ($oAccounts as $oAccount)
        $oTransactions = $oTransactionsClient->listCashTransactions($oAccount->getId())->getItems();
        /** @var \NxSys\Library\Clients\Brex\API\Transactions\Model\CashTransaction[] $oTransactions */

Adding a User

$oNewUser=new \NxSys\Library\Clients\Brex\API\Team\Model\CreateUserRequest;

//@throws on failure


If there’s anything on your mind, or if you have questions regarding the use of this library please reach out, dialogue is welcomed.

Project Governance

This project is primarily maintained by, but not sponsored by, Nexus Systems, Inc. Please note that absent a 2/3 decision by the project members writ large, all final decisions are made by Nexus Systems.