PHPackages                             via-work/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. via-work/lever-php

ActiveLibrary

via-work/lever-php
==================

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

2.0.1(5y ago)05262MITPHPPHP ^7.3CI failing

Since Apr 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/via-work/lever-php)[ Packagist](https://packagist.org/packages/via-work/lever-php)[ Docs](https://github.com/via-work/lever-php)[ RSS](/packages/via-work-lever-php/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (7)Dependencies (6)Versions (8)Used By (0)

Lever PHP
=========

[](#lever-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bab04702825b55ea625aaae4dc0fcbd8d1629940cec149d5087cd2be90f6bb15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7669612d776f726b2f6c657665722d7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/via-work/lever-php)[![Build Status](https://camo.githubusercontent.com/d431e0188c9bded4b3abf105881f82e567449fabf3217cf4e3bb4f02442a34bf/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7669612d776f726b2f6c657665722d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/via-work/lever-php)[![Quality Score](https://camo.githubusercontent.com/52ad045e2cb4e7f8e1b87ad9b93d88d6e05fe953f7b6b215d046cea7d5badbf6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7669612d776f726b2f6c657665722d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/via-work/lever-php)[![Total Downloads](https://camo.githubusercontent.com/f025a6d0d5b64eefb8b8b368607d406d647e6f44b6b58b2eec524ceea3b17b78/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7669612d776f726b2f6c657665722d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/via-work/lever-php)[![StyleCI](https://camo.githubusercontent.com/a4a153a53719069e45879d93afbefe52c78b217eb30438b0efada26c8c523f3e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233383738363334372f736869656c643f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/a4a153a53719069e45879d93afbefe52c78b217eb30438b0efada26c8c523f3e/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233383738363334372f736869656c643f6272616e63683d6d6173746572)

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

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

[](#installation)

You can install the package via composer:

```
composer require via-work/lever-php
```

Usage
-----

[](#usage)

#### PHP

[](#php)

```
use \ViaWork\LeverPhp\LeverPhp;

$lever = new LeverPhp('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="ViaWork\LeverPhp\LeverPhpServiceProvider"
```

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)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.4% 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 ~65 days

Recently: every ~93 days

Total

7

Last Release

1838d ago

Major Versions

1.0.4 → 2.0.02021-04-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c5c19804b13fcf8444b26363131fa0070d0700bfcf1d4be495f0a19ec18b0b1?d=identicon)[via-work](/maintainers/via-work)

![](https://www.gravatar.com/avatar/39522ae95bfeb38e894ae2912c12e59d81476a5b3381f546e29768127be84c7e?d=identicon)[strotgen](/maintainers/strotgen)

---

Top Contributors

[![strotgen](https://avatars.githubusercontent.com/u/14982436?v=4)](https://github.com/strotgen "strotgen (51 commits)")[![omarsancas](https://avatars.githubusercontent.com/u/7347292?v=4)](https://github.com/omarsancas "omarsancas (7 commits)")[![chasebolt](https://avatars.githubusercontent.com/u/1222984?v=4)](https://github.com/chasebolt "chasebolt (1 commits)")

---

Tags

wrapperjobsdata apilever

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[aerni/laravel-spotify

A Laravel wrapper for the Spotify Web API

209145.6k](/packages/aerni-laravel-spotify)[marcreichel/igdb-laravel

A Laravel wrapper for version 4 of the IGDB API (Apicalypse) including webhook handling

115146.6k1](/packages/marcreichel-igdb-laravel)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6454.8k2](/packages/gearbox-solutions-eloquent-filemaker)

PHPackages © 2026

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