PHP code example of darvis / bullhorn-api

1. Go to this page and download the library: Download darvis/bullhorn-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

darvis / bullhorn-api example snippets


use Darvis\BullhornApi\Laravel\Facades\Bullhorn;

$candidate = Bullhorn::entity('Candidate', 123, ['id', 'firstName', 'email'])['data'];

$id = Bullhorn::createEntity('Candidate', ['firstName' => 'Anna', 'lastName' => 'Smit', 'name' => 'Anna Smit'])['changedEntityId'];

Bullhorn::updateEntity('Candidate', $id, ['phone' => '0612345678']);

$found = Bullhorn::search('Candidate', 'email:"[email protected]"', 'id,firstName');

use Darvis\BullhornApi\Client;
use Darvis\BullhornApi\Config;
use Darvis\BullhornApi\Token\FileTokenStore;

$bullhorn = new Client(
    new Config(clientId: '...', clientSecret: '...', username: '...', password: '...'),
    store: new FileTokenStore('/var/lib/myapp/bullhorn'),
);

$bullhorn->updateEntity('Candidate', 123, ['status' => 'Active']);

use Darvis\BullhornApi\Laravel\Facades\Bullhorn;

if (Bullhorn::isAlive()) {
    // Bullhorn answers: show the vacancies, accept the application.
} else {
    // Show "we are working on it" instead of an error page.
}

use Illuminate\Support\Facades\Cache;

$alive = Cache::remember('bullhorn-alive', 60, fn () => Bullhorn::isAlive());
bash
php artisan bullhorn:test
bash
  php examples/01-is-bullhorn-alive.php