PHPackages                             jonathanraftery/bullhorn-rest-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jonathanraftery/bullhorn-rest-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jonathanraftery/bullhorn-rest-client
====================================

Simple REST client for the Bullhorn API, including automated OAuth2 login

1.4.2(1y ago)1142.7k↓12.5%15[7 issues](https://github.com/jonathanraftery/bullhorn-rest-client/issues)MITPHPPHP ^7.3|^8.0

Since Jul 2Pushed 1y ago3 watchersCompare

[ Source](https://github.com/jonathanraftery/bullhorn-rest-client)[ Packagist](https://packagist.org/packages/jonathanraftery/bullhorn-rest-client)[ RSS](/packages/jonathanraftery-bullhorn-rest-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (18)Used By (0)

Bullhorn REST Client
====================

[](#bullhorn-rest-client)

Provides a simple client for the Bullhorn REST API.

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

[](#installation)

```
$ composer require jonathanraftery/bullhorn-rest-client
```

Usage
-----

[](#usage)

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
$client = new BullhornClient();
```

By default, the client will look for credentials in environment variables:

- BULLHORN\_CLIENT\_ID
- BULLHORN\_CLIENT\_SECRET
- BULLHORN\_USERNAME
- BULLHORN\_PASSWORD

### Options

[](#options)

The client constructor accepts an option array.

```
use jonathanraftery\Bullhorn\Rest\Auth\CredentialsProvider\MemoryCredentialsProvider;
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
use jonathanraftery\Bullhorn\Rest\ClientOptions;

$client = new BullhornClient([
    // NOTE: MemoryCredentialProvider not recommended for production
    ClientOptions::CredentialsProvider => new MemoryCredentialsProvider(
        'clientId', 'clientSecret', 'username', 'password'
    ),
]);
```

The ClientOptions class can be used to view the available options.

### Credential Providers

[](#credential-providers)

A credential provider supplies the client with the credentials needed to connect to the API. There are simple providers included, or you can create your own with a class implementing the CredentialsProviderInterface (for example, to fetch credentials from Google Cloud Secret Manager).

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
use jonathanraftery\Bullhorn\Rest\ClientOptions;
use jonathanraftery\Bullhorn\Rest\Auth\CredentialsProvider\CredentialsProviderInterface;

class CustomCredentialProvider implements CredentialsProviderInterface {
    public function getClientId() : string{ return 'id'; }
    public function getClientSecret() : string{ return 'secret'; }
    public function getUsername() : string{ return 'username'; }
    public function getPassword() : string{ return 'password'; }
}

$client = new BullhornClient([
    ClientOptions::CredentialsProvider => new CustomCredentialProvider()
]);
```

By default, the client will use an EnvironmentCredentialsProvider, which will look in the environment variables listed above for credentials. The variables used can be changed by constructing an EnvironmentCredentialsProvider with the other variables.

### Auth Data Stores

[](#auth-data-stores)

API session data needs persisted in a data store. By default, the client will use a local JSON file for this store, but custom stores can be used.

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
use jonathanraftery\Bullhorn\Rest\ClientOptions;
use jonathanraftery\Bullhorn\Rest\Auth\Store\DataStoreInterface;

class CustomDataStore implements DataStoreInterface {
    private $vars;

    public function get(string $key) : ?string{
        return $this->vars[$key];
    }

    public function store(string $key,$value){
        $this->vars[$key] = $value;
    }
}

$client = new BullhornClient([
    ClientOptions::AuthDataStore => new CustomDataStore()
]);
```

### Initial OAuth consent

[](#initial-oauth-consent)

Before Bullhorn authorizes API calls from a new user, the user is required to give consent. If no consent has been given yet the library will throw an IdentityException and the client will respond with an HTML representation of the consent form.

To permanently fix this, visit the authorization URL with your credentials [auth.bullhornstaffing.com/oauth/authorize?response\_type=code&amp;action=Login&amp;username=&amp;password=&amp;state=&lt;client\_secret&gt;&amp;approval\_prompt=auto&amp;client\_id=&lt;client\_id&gt;](https://auth.bullhornstaffing.com/oauth/authorize?response_type=code&action=Login&username=%3Cusername%3E&password=%3Cpassword%3E&state=%3Cclient_secret%3E&approval_prompt=auto&client_id=%3Cclient_id%3E) while logged into bullhorn and press the **Agree** button. This will authorize your application to use the API in the user's name.

### Raw Requests

[](#raw-requests)

Simple requests as documented in the Bullhorn API documentation can be run as:

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
$client = new BullhornClient();
$response = $client->rawRequest(
    'GET',
    'search/JobOrder',
    [
        'query' => 'id:1234'
    ]
);
```

### PUT/POST Requests

[](#putpost-requests)

The client uses [GuzzleHTTP](http://docs.guzzlephp.org/en/stable/) for requests, and the parameters to the request method match those to create a request object in Guzzle. The third parameter is the request options, as described in the [Guzzle documentation](http://docs.guzzlephp.org/en/stable/request-options.html).

To set the body of a PUT/POST request, set the "body" option of the request to the JSON content of the request body such as:

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
$client = new BullhornClient();
$response = $client->rawRequest(
    'PUT',
    'entity/Candidate',
    [
        'body' => json_encode(['firstName' => 'Alanzo', 'lastName' => 'Smith', 'status' => 'Registered'])
    ]
);
```

### Entity Operations

[](#entity-operations)

Entities can be fetched, created, and deleted

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
use jonathanraftery\Bullhorn\Rest\BullhornEntities;
$client = new BullhornClient();
$fetchedJobOrders = $client->fetchEntities(BullhornEntities::JobOrder, [1,2,3], [
    'fields' => 'id',
]);
$createdJobOrder = $client->createEntity(BullhornEntities::JobOrder, [
    'propName' => 'value',
    'propName2' => 'value',
]);
$deleteId = 1;
$client->deleteEntity(BullhornEntities::JobOrder, $deleteId);
```

### Event Subscriptions

[](#event-subscriptions)

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
use jonathanraftery\Bullhorn\Rest\BullhornEntities;
use jonathanraftery\Bullhorn\Rest\EventTypes;
$client = new BullhornClient();
$client->createEventSubscription('SubscriptionName', [BullhornEntities::JobOrder], [EventTypes::Created]);
$client->fetchEventSubscriptionEvents('SubscriptionName');
$client->deleteEventSubscription('SubscriptionName');
```

### Sessions

[](#sessions)

A session will automatically be initiated upon the first request if no session exists in the data store.

A session can be manually initiated with:

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
$client = new BullhornClient();
$client->initiateSession();
```

The session will automatically refresh if expiration detected, or can be refreshed manually (shown with optional parameters)

```
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient;
$client = new BullhornClient();
$client->refreshSession(['ttl' => 60]);
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 86.6% 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 ~178 days

Recently: every ~409 days

Total

15

Last Release

385d ago

Major Versions

v0.3.4 → 1.0.02020-11-03

PHP version history (2 changes)1.0.0PHP ^7.3

1.4.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12540015?v=4)[Jonathan Raftery](/maintainers/jonathanraftery)[@jonathanraftery](https://github.com/jonathanraftery)

---

Top Contributors

[![jonathanraftery](https://avatars.githubusercontent.com/u/12540015?v=4)](https://github.com/jonathanraftery "jonathanraftery (71 commits)")[![40katty04](https://avatars.githubusercontent.com/u/38152697?v=4)](https://github.com/40katty04 "40katty04 (4 commits)")[![survivorbat](https://avatars.githubusercontent.com/u/32467485?v=4)](https://github.com/survivorbat "survivorbat (2 commits)")[![kenziedeschepper](https://avatars.githubusercontent.com/u/84901264?v=4)](https://github.com/kenziedeschepper "kenziedeschepper (1 commits)")[![sjerdo](https://avatars.githubusercontent.com/u/5910750?v=4)](https://github.com/sjerdo "sjerdo (1 commits)")[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (1 commits)")[![drmmr763](https://avatars.githubusercontent.com/u/643104?v=4)](https://github.com/drmmr763 "drmmr763 (1 commits)")[![KajdeMunter](https://avatars.githubusercontent.com/u/16755595?v=4)](https://github.com/KajdeMunter "KajdeMunter (1 commits)")

---

Tags

apiclientrestbullhorn

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jonathanraftery-bullhorn-rest-client/health.svg)

```
[![Health](https://phpackages.com/badges/jonathanraftery-bullhorn-rest-client/health.svg)](https://phpackages.com/packages/jonathanraftery-bullhorn-rest-client)
```

###  Alternatives

[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[pdffiller/pdffiller-php-api-client

PHP client for pdffiller.com REST API

14140.2k](/packages/pdffiller-pdffiller-php-api-client)[rastor/jira-client

A simple PHP JIRA REST client

2070.7k](/packages/rastor-jira-client)[meteocontrol/vcom-api-client

HTTP Client for meteocontrol's VCOM API - The VCOM API enables you to directly access your data on the meteocontrol platform.

175.7k1](/packages/meteocontrol-vcom-api-client)[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)
