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

ActiveLibrary[API Development](/categories/api)

bluelightco/lever-php
=====================

Super-simple, minimum abstraction Lever DATA API v1 wrapper in PHP with support for Laravel.

v1.0.12(1mo ago)01.4k↓79.4%MITPHPPHP ^8.2CI passing

Since Jun 26Pushed 1mo agoCompare

[ Source](https://github.com/bluelightco/lever-php)[ Packagist](https://packagist.org/packages/bluelightco/lever-php)[ Docs](https://github.com/bluelightco/lever-php)[ RSS](/packages/bluelightco-lever-php/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (21)Versions (19)Used By (0)

Lever PHP
=========

[](#lever-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f7ccb5733e678865c9a9d6933060e66789517925436a806dda6fe2bd149601bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c75656c69676874636f2f6c657665722d7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bluelightco/lever-php)[![Total Downloads](https://camo.githubusercontent.com/cf6b27051c1e9ba8e7874686c700d126bc43d22f820ff2f9e2ea670a733c7857/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626c75656c69676874636f2f6c657665722d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bluelightco/lever-php)

Super-simple Lever Data API v1 wrapper in PHP with support for Laravel.

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

[](#installation)

You can install the package via composer:

```
composer require bluelightco/lever-php
```

Usage
-----

[](#usage)

#### PHP

[](#php)

```
use \Bluelightco\LeverPhp\Http\Client\LeverClient;

$lever = new LeverClient('leverKey');

$lever->opportunities()->fetch();
```

#### Laravel

[](#laravel)

After installing, the package will automatically register its service provider.

To publish the config file to config/lever-php.php run:

```
php artisan vendor:publish --provider="Bluelightco\LeverPhp\Providers\LeverServiceProvider" --tag="config"
```

After changing your API keys in your ENV file accordingly, you can call a Lever instance as follows:

```
Lever::opportunities()->fetch();
```

### Methods

[](#methods)

This package is modeled after [Lever's Data API documentation](https://hire.lever.co/developer/documentation), so you should be able to find a method for many of the endpoints.

For example, if you would like to fetch all Opportunities you would simply call:

```
Lever::opportunities()->fetch();
```

To retrieve a single opportunity you should call the same method while passing the id as a parameter:

```
Lever::opportunities('250d8f03-738a-4bba-a671-8a3d73477145')->fetch();
```

To create an opportunity use the create method while passing the fields array (use same names as Lever):

```
$newOpportunity = [
                   'name' => 'Shane Smith',
                   'headline' => 'Brickly LLC, Vandelay Industries, Inc, Central Perk',
                   'stage' => '00922a60-7c15-422b-b086-f62000824fd7',
                    ...
                  ];

Lever::opportunities()->create($newOpportunity);
```

When submiting an application on behalf of a candidate to a specific posting you should use the following method:

```
$application = [
                   'customQuestions' => [...],
                   'personalInformation' => [...],
                   'ipAddress' => '184.23.195.146',
                    ...
                  ];

Lever::opportunities('730e37db-93d3-4acf-b9de-7cfc397cef1d')
    ->sendConfirmationEmail()
    ->apply($application);
```

When an update endpoint is available, you can do it as follows:

```
$posting = [
             'text' => 'Infrastructure Engineer',
             'state' => 'published',
             ...
           ];

Lever::postings('730e37db-93d3-4acf-b9de-7cfc397cef1d')
    ->performAs('8d49b010-cc6a-4f40-ace5-e86061c677ed')
    ->update($posting);
```

Be aware of the resources that require some parameters to work. When creating a posting for example, the *perform\_as* parameter is required. You can pass this information with the `performAs($userId)` method.

When a resource depends on another one to work, you can simply chain the methods (order is important). For example, to retrieve the **offers** of a **opportunity**, you should execute this:

```
Lever::opportunities('250d8f03-738a-4bba-a671-8a3d73477145')->offers()->fetch();
```

When Lever asks to use the PUT verb, you can use `putUpdate()` instead of `update()` (POST).

#### Parameters

[](#parameters)

There are many helper methods available to include parameters in a request. For example, to *include* the *followers* and *expand applications* and *stages*, when fetching opportunities, you can do so:

```
Lever::opportunities()
    ->include('followers')
    ->expand(['applications', 'stages'])
    ->expand('posting')
    ->fetch();
```

Notice you can pass a string or an array of strings in both methods, and you can chain the same method many times if you wish.

Not all parameters have a method available, but you can use the `addParameter($field, $value)` method for this. This method can be chained without overwriting previous values. For example:

```
Lever::opportunities()
    ->addParameter('origin', 'applied')
    ->addParameter('posting_id', 'f2f01e16-27f8-4711-a728-7d49499795a0')
    ->fetch();
```

Be aware that when using the same field name, the new value will be appended and not overwritten.

#### Uploading files and resumes

[](#uploading-files-and-resumes)

LeverPhp allows you to include resumes or files when available. To do this, you have to include the file in the fields array (see example) and chaining the `hasFiles()` method (before the `create` or `update` method!). For example, you can append a resume when creating an opportunity:

```
$newOpportunity = [
                   'name' => 'Shane Smith',
                   'headline' => 'Brickly LLC, Vandelay Industries, Inc, Central Perk',
                   'resumeFile' => [
                        'file' => file_get_contents('path/to/resume.pdf'),
                        'name' => 'resume.pdf'
                        'type' => mime_content_type('path/to/resume.pdf'), // application/pdf
                        ]
                  ];

Lever::opportunities()->hasFiles()->create($newOpportunity);
```

Currently, there is no support for multiple files in one call.

#### Pagination

[](#pagination)

All Lever resources with a list endpoint (candidates, users, postings) have pagination and a max limit of 100 results per page. LeverPhp handles this automatically leveraging Laravel [LazyCollection](https://laravel.com/docs/6.x/collections#lazy-collections) class. For example, you can iterate over the whole set of Opportunities without worrying about pagination:

```
$opportunities = Lever::opportunities()->fetch();

foreach ($opportunities as $opportunity) {
    echo $opportunity['name];
}
```

When item hundred is reached, another call is made to the API requesting the next 100 items until there are no more left.

Of course you can take advantage of all [methods available](https://laravel.com/docs/6.x/collections#the-enumerable-contract) on the LazyCollection class.

#### Rate Limit and Exponential Backoff

[](#rate-limit-and-exponential-backoff)

By default, Lever API allows a steady state number of 10 requests/second per API key.

To comply with this, **LeverPhp** automatically limits the number of requests to the Lever Data API to 10 per second and uses [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) to decrease the retry rate when a 429 or 500 response is received. Please plan you code accordingly, as a request might take much longer than expected because of this. Using some kind of queues is suggested.

> By default, the rate limiter works in memory. This means that if you have a second PHP process (or Guzzle client) consuming the same API, you'd still possibly hit the rate limit.

The `LeverPhp()` constructor accepts a custom store in its third parameter to overcome the in memory issue. If you are using Laravel, a custom store that uses your cache driver is already configured. Please see the documentation of [GuzzleRateLimiterMiddleware](https://github.com/spatie/guzzle-rate-limiter-middleware#custom-stores) if you need more information.

#### Client

[](#client)

If a method is not available for the resource you are trying to reach, you can get an instance of the Guzzle client directly by calling `Lever::client()`. Feel free to add it to the source code. Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Omar Sánchez](https://github.com/omarsancas)
- [Alfonso Strotgen](https://github.com/strotgen)
- [Via.work](https://github.com/via-work)
- [Javier Villatoro](https://github.com/strotgen)
- [Bluelight](https://github.com/bluelightco)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~53 days

Recently: every ~162 days

Total

14

Last Release

45d ago

Major Versions

v0.1.0 → v1.0.12024-07-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50691719?v=4)[Bluelight](/maintainers/bluelightco)[@bluelightco](https://github.com/bluelightco)

---

Top Contributors

[![strotgen](https://avatars.githubusercontent.com/u/14982436?v=4)](https://github.com/strotgen "strotgen (51 commits)")[![javier-villatoro](https://avatars.githubusercontent.com/u/172317392?v=4)](https://github.com/javier-villatoro "javier-villatoro (36 commits)")[![omarsancas](https://avatars.githubusercontent.com/u/7347292?v=4)](https://github.com/omarsancas "omarsancas (7 commits)")[![JasonHolderness-bl](https://avatars.githubusercontent.com/u/180605115?v=4)](https://github.com/JasonHolderness-bl "JasonHolderness-bl (6 commits)")[![chasebolt](https://avatars.githubusercontent.com/u/1222984?v=4)](https://github.com/chasebolt "chasebolt (3 commits)")

---

Tags

wrapperjobsdata apilever

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bluelightco-lever-php/health.svg)

```
[![Health](https://phpackages.com/badges/bluelightco-lever-php/health.svg)](https://phpackages.com/packages/bluelightco-lever-php)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M45](/packages/tencentcloud-tencentcloud-sdk-php)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.7k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

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