PHPackages                             nikspyratos/investec-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. nikspyratos/investec-sdk-php

AbandonedArchivedLibrary

nikspyratos/investec-sdk-php
============================

Investec SDK for PHP

v1.0.0(2y ago)9621MITPHPPHP ^8.1

Since Jun 29Pushed 1y ago2 watchersCompare

[ Source](https://github.com/nikspyratos/investec-sdk-php)[ Packagist](https://packagist.org/packages/nikspyratos/investec-sdk-php)[ Docs](https://github.com/nikspyratos/investec-sdk-php)[ GitHub Sponsors](https://github.com/nikspyratos)[ RSS](/packages/nikspyratos-investec-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Looking for maintainers
=======================

[](#looking-for-maintainers)

This package is mostly a simple wrapper around the API - it is perfectly simple to implement it yourself, with or without extra tooling like Saloon.

I unfortunately don't have the time to keep this up to date (especially as I am no longer an Investec customer myself). If you're keen to take over, please reach out or feel free to fork the repo.

Investec API SDK for PHP
========================

[](#investec-api-sdk-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f8d7144de476a6ac4439f90e8250592341b46a1c412da1eff27c66a1fa2ce13a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e696b7370797261746f732f696e7665737465632d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nikspyratos/investec-sdk-php)[![Tests](https://camo.githubusercontent.com/219e62bd9b07e8087775b9988241528d1610898aa5e0d4a0f1648e6a89d1dd2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e696b7370797261746f732f696e7665737465632d73646b2d7068702f72756e2d74657374732d706573742e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/nikspyratos/investec-sdk-php/actions/workflows/run-tests-pest.yml)[![Total Downloads](https://camo.githubusercontent.com/7b1ccb9e81e6932b4f66a12337d5cb610aecbd4f21407c1e0b3f88bfbd573f09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e696b7370797261746f732f696e7665737465632d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nikspyratos/investec-sdk-php)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

- [Investec API SDK for PHP](#investec-api-sdk-for-php)
    - [Support](#support)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Internal use](#internal-use)
        - [External use](#external-use)
        - [Environments](#environments)
        - [Data Transfer Objects](#data-transfer-objects)
    - [Testing](#testing)
    - [Roadmap](#roadmap)
    - [Changelog](#changelog)
    - [Contributing](#contributing)
    - [Security Vulnerabilities](#security-vulnerabilities)
    - [Credits](#credits)
    - [License](#license)

This is a PHP SDK for [Investec's API](https://developer.investec.com/za/api-products/), using [Saloon](https://github.com/Sammyjo20/Saloon).

This is a community-made package, and not directly affiliated with Investec.

Support
-------

[](#support)

- [Buy me a coffee](https://tip-jar.co.za/@thecapegreek)
- I also [consult in the Laravel &amp; payments space](https://nik.software)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require nikspyratos/investec-sdk-php
```

**NOTE**: Currently, the stable release only includes support for authorization (both personal and 3-legged OAuth) and the Private Banking API. Other APIs are written but untested. See [Roadmap](#roadmap) for more details.

If you would like to use these other APIs, install from the `main` branch:

```
composer require nikspyratos/investec-sdk-php:"dev-main"
```

Usage
-----

[](#usage)

See the [package documentation](DOCUMENTATION.md) and [API documentation](https://developer.investec.com/za/api-products) for more details.

If you're accessing your own account data, see [Internal use](#internal-use). If you're accessing Investec customer data, see [External use](#external-use).

See [Environments](#environments) for accessing the Sandbox environment.

### Internal use

[](#internal-use)

Firstly, make sure you've [obtained your API credentials](https://offerzen.gitbook.io/programmable-banking-community-wiki/get-started/api-quick-start-guide#how-to-get-your-api-keys) - this is how you get your client ID, secret and API key.

Note: `Internal use` access tokens have a lifespan of 30 minutes.

```
use InvestecSdkPhp\Connectors\InvestecConnector;

$clientId = '';
$clientSecret = '';
$apiKey = '';

//Initialise the API Connector
$connector = new InvestecConnector($clientId, $clientSecret, $apiKey);

//Get an access token
$authenticator = $connector->getAccessToken();

//Use it to authenticate requests for Private Banking
$api = $connector->privateBanking($authenticator);

//Have fun!
$data = $api->getAccounts();
```

### External use

[](#external-use)

See [API documentation](https://developer.investec.com/za/api-products) for details.

Your organisation will need to chat with Investec directly to get access. The Investec API uses an OAuth flow for the customer to grant access to you for their data.

Reminder: This package is not affiliated with Investec.

```
use InvestecSdkPhp\Connectors\InvestecOAuthConnector;

$clientId = '';
$clientSecret = '';
$redirectUri = '';

//Initialise the API Connector
$connector = new InvestecOAuthConnector($clientId, $clientSecret);

//Create an OAuth authorization URL. You redirect your user to this
$authUrl = $connector->getAuthorizationUrl($redirectUri);
```

After being redirected back to your specified `$redirectUri`, you should have a code. Proceed as usual:

```
//Authorization code from the redirect
$code = ''

//Initialise the API Connector
$connector = new InvestecOAuthConnector($clientId, $clientSecret);

//Get an access token - this will still require the redirect URI
$authenticator = $connector->getAccessToken($redirectUri, $code);

//Use it to authenticate requests for Private Banking
$api = $connector->privateBanking($authenticator);

//Have fun!
$data = $api->getAccounts();
```

### Environments

[](#environments)

The API offers two environments: Sandbox and Production.

By default this SDK will use the Production environment. To change this, you may specify the environment using the provided enum like so:

```
use InvestecSdkPhp\Enumerations\Environment;
$connector = new InvestecConnector($clientId, $clientSecret, Environment::SANDBOX);
```

### Data Transfer Objects

[](#data-transfer-objects)

For `Transfer Multiple` and `Pay Multiple` endpoints, arrays of beneficiaries/accounts are accepted.

To handle this in a structured manner this package uses `dragon-code/simple-dto` to build the DTOs with the required data.

Testing
-------

[](#testing)

Tests are set to run with sandbox credentials (which Investec provides us with, luckily).

```
cp .env.example .env
```

Then, copy the sandbox environment variable values from [here](https://developer.investec.com/za/api-products/documentation/SA_PB_Account_Information#section/Sandbox) into your .env file.

Then, to run tests:

```
vendor/bin/pest
```

TODO
----

[](#todo)

1. Using the excellent [Saloon SDK Generator](https://github.com/crescat-io/saloon-sdk-generator), the remaining APIs have been implemented, save for some Forex API endpoints:

- `Update BOP Report` - the input is massive and has several nested arrays and objects, resulting in a DTO nightmare currently.
- `Validate BOP Report` - similar issues to `Update BOP Report`.
- `Upload file contents for document handle` - documentation is unclear on how to fill in this data.

2. For the non-Private Banking implemented endpoints, tests are either not working (sandbox credentials issue) or are unwritten. Given that, their resource methods are marked as experimental. If you would like to see any of those APIs be more actively supported, please:

- Let me know if it works, any issues you run into, etc.
- Make a PR with working tests for an API matching the existing testing style, using PestPHP
- Make a PR updating the [Documentation](DOCUMENTATION.md) with usage guides for the remaining endpoints

TODOs:

- Tests for remaining API endpoint groups

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Nik Spyratos](https://github.com/nikspyratos)
- [All Contributors](../../contributors)
- [Saloon](https://docs.saloon.dev)
- [Saloon SDK Generator](https://github.com/crescat-io/saloon-sdk-generator) for speeding up the work on the remaining APIs!

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1048d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87b0275b4a864c7d960d18ec4d03a96711a2ee983e7faf1d65edf2d46a5d0166?d=identicon)[nikspyratos](/maintainers/nikspyratos)

---

Top Contributors

[![nikspyratos](https://avatars.githubusercontent.com/u/17888779?v=4)](https://github.com/nikspyratos "nikspyratos (64 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

sdkInvestec

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nikspyratos-investec-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/nikspyratos-investec-sdk-php/health.svg)](https://phpackages.com/packages/nikspyratos-investec-sdk-php)
```

###  Alternatives

[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[jeffreyhyer/alpaca-trade-api-php

PHP SDK for the Alpaca trade API

285.0k](/packages/jeffreyhyer-alpaca-trade-api-php)[repat/plentymarkets-rest-client

REST Client for Plentymarkets

1510.0k](/packages/repat-plentymarkets-rest-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
