PHPackages                             networkrailbusinesssystems/bravo-api - 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. [API Development](/categories/api)
4. /
5. networkrailbusinesssystems/bravo-api

ActiveLibrary[API Development](/categories/api)

networkrailbusinesssystems/bravo-api
====================================

Package to send and retrieve data from the Bravo rest API

1.4.3(3y ago)01.2kMITPHPPHP ^8.0

Since Sep 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Network-Rail-Business-Systems/bravo-api)[ Packagist](https://packagist.org/packages/networkrailbusinesssystems/bravo-api)[ RSS](/packages/networkrailbusinesssystems-bravo-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (0)

Bravo API
=========

[](#bravo-api)

A Laravel package to send and retrieve data from Bravo using the Bravo rest API.

Contents
--------

[](#contents)

- [About](#about)
- [Config](#config)
- [Proxy](#proxy)
- [Create Project](#create-project)
    - [User Object](#user-object)
    - [Category List](#category-list)
    - [Workflow Type](#workflow-type)
    - [Lot Type](#lot-type)
- [Update Project](#update-project)
- [Search Projects](#search-projects)
- [Get Project](#get-project)
- [Tests](#tests)
- [Development](#development)

About
-----

[](#about)

- The Laravel Http Client is used to make requests to the Bravo API
- The package has a set of typed objects that are used to construct the request objects in the correct format.
- The responses are passed through DataTransferObjects to cast the response from a json response into typed objects

Config
------

[](#config)

You can publish the configuration if required:

`php artisan vendor:publish --provider="NetworkRailBusinessSystems\BravoApi\BravoApiServiceProvider"`

You will need to set the following in your .env file as a minimum:

```
BRAVO_API_USERNAME=
BRAVO_API_PASSWORD=
BRAVO_API_BASE_URL=
```

The base url is in the following format `https:///esop/jint/api/public/`. For example `https://customername.com/esop/jint/api/public/`. The api package is designed to work with v1 of the Bravo API.

If you want to alter the default token cache time (10 minutes by default), then, for example, set the following to 20 minutes:

```
BRAVO_API_TOKEN_CACHE=20
```

KeyTypeDefaultBRAVO\_API\_USERNAMEstringnullBRAVO\_API\_PASSWORDstringnullBRAVO\_API\_GRANT\_TYPEstringclient\_credentialsBRAVO\_API\_BASE\_URLstringnullBRAVO\_API\_TOKEN\_CACHEinteger10BRAVO\_API\_PROXY\_ADDRESSstringnullBRAVO\_API\_TIMEOUTinteger10BRAVO\_API\_RETRY\_COUNTinteger3BRAVO\_API\_RETRY\_INTERVALinteger5000Proxy:
------

[](#proxy)

The HTTP Client requires a proxy to be able to connect with Bravo's API when the application is deployed on the servers.

This is already configured for you however, you must ensure that the `APP_ENV` property in the `.env` file is to either **staging** or **production** for it to be applied. It will not be applied when set to **local** or **testing**.

Create Project
--------------

[](#create-project)

```
use NetworkRailBusinessSystems\BravoApi\BravoApi;
use NetworkRailBusinessSystems\BravoApi\RequestObjects\Project;

$bravoApi = new BravoApi();

$project = new Project();
$project->tender->title = 'My Project Title';

$response = $bravoApi->createProject($project);

echo $response->returnCode; // 0
echo $response->tenderCode; // 'tender_1000111
echo $response->tenderReferenceCode; // 1000111
```

By default, the `projectOperation` is 'CREATE\_FROM\_TEMPLATE'. This requires that the `$project->tender->sourceTemplateCode` or the `$project->tender->sourceTemplateReferenceCode` is set. The sourceTemplateCode is the `tender_1234` style code and the sourceTemplateReferenceCode is the `project_1234` style code.

```
$bravoApi = new BravoApi();

$project = new Project();
$project->tender->title = 'My Project Title';
$project->tender->sourceTemplateReferenceCode = 'project_1234';

$response = $bravoApi->createProject(
    project: $project,
    fromTemplate: true
);
```

To create a new project without creating from a template, set the `fromTemplate` argument in `createProject()` to false;

```
$bravoApi = new BravoApi();

$project = new Project();
$project->tender->title = 'My Project Title';

$response = $bravoApi->createProject(
    project: $project,
    fromTemplate: false
);
```

### User Object

[](#user-object)

The User request object allows the Bravo username to be passed in to the `login` property, or you can use the Bravo `id` and `name` if they are known.

```
use NetworkRailBusinessSystems\BravoApi\RequestObjects\User;
use \NetworkRailBusinessSystems\BravoApi\RequestObjects\Project;

$user = new User();

// Set the login as the user's email address
$user->login = 'example@email.com';

// Or set the Bravo id and name if known
$user->id = '1234';
$user->name = 'Joe Bloggs';

$project = new Project();
$project->tender->projectOwner = $user;
```

### Category List

[](#category-list)

The category list allows you to set the category code and the category name when creating the Project. The category code needs to match the category code exactly in Bravo.

```
use \NetworkRailBusinessSystems\BravoApi\RequestObjects\Category;
use \NetworkRailBusinessSystems\BravoApi\RequestObjects\Project;

$category = new Category();
$category->categoryName = 'A Test Category';
$category->categoryCode = '01.01.01.99';

$project = new Project();
$project->categoryList->category[] = $category;
```

### Workflow Type

[](#workflow-type)

The workflow type is an instance of a Spatie Enum and has set values of `LOCKED`, `UNLOCKED` or `NONE`.

A tender has a default workflow type of `NONE`.

### Lot Type

[](#lot-type)

The lot type is an instance of a Spatie Enum and has set values of `SINGLELOTS` or `MULTILOTS`.

A tender has a default workflow type of `SINGLELOTS`.

Update Project
--------------

[](#update-project)

To update a project, the `tenderCode` or `tenderReferenceCode` is required, otherwise a BravoApiException is thrown.

```
use NetworkRailBusinessSystems\BravoApi\BravoApi;
use NetworkRailBusinessSystems\BravoApi\RequestObjects\Project;

$bravoApi = new BravoApi();

$project = new Project();

$project->tender->title = 'My Project Title';

$response = $bravoApi->updateProject($project);

echo $response->returnCode; // 0
echo $response->tenderCode; // 'tender_1000111
echo $response->tenderReferenceCode; // 1000111
```

Search Projects
---------------

[](#search-projects)

Pass in the search term, based on the FIQL query string. Use the [FIQL Query](https://github.com/Network-Rail-Business-Systems/fiql-query) package for a more human-readable way to construct the filter.

The response will contain a project list, which contains a collection of projects.

```
use NetworkRailBusinessSystems\BravoApi\BravoApi;

$bravoApi = new BravoApi();
$response = $bravoApi->searchProjects('title==test');

echo $response->projectList->project->first()->tender->title; // Test
```

You can also pass in additional filters (deFilt and comp), as well as the startAt.

Get Project
-----------

[](#get-project)

Pass in the id for the project you wish to get.

```
use NetworkRailBusinessSystems\BravoApi\BravoApi;

$bravoApi = new BravoApi();
$response = $bravoApi->getProject('tender_10001');

echo $response->projectList->project->first()->tender->title; // Test
```

Tests
-----

[](#tests)

Run `composer install` to install dependencies and then `vendor/bin/phpunit` to run the tests.

Development
-----------

[](#development)

Run `npm install` to install husky for the post commit git hooks.

The package uses prettier to format the php code layout on git commit.

The package has Larastan installed for static analysis, which has also been added as a lint-staged task. To run it manually, run `./vendor/bin/phpstan analyse`

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~15 days

Recently: every ~37 days

Total

11

Last Release

1186d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17785811?v=4)[Anthony Edmonds](/maintainers/AnthonyEdmonds)[@AnthonyEdmonds](https://github.com/AnthonyEdmonds)

---

Top Contributors

[![AnthonyEdmonds](https://avatars.githubusercontent.com/u/17785811?v=4)](https://github.com/AnthonyEdmonds "AnthonyEdmonds (26 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/networkrailbusinesssystems-bravo-api/health.svg)

```
[![Health](https://phpackages.com/badges/networkrailbusinesssystems-bravo-api/health.svg)](https://phpackages.com/packages/networkrailbusinesssystems-bravo-api)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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