PHPackages                             wheniwork/oauth2-zenpayroll - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. wheniwork/oauth2-zenpayroll

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

wheniwork/oauth2-zenpayroll
===========================

ZenPayroll OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v0.1.0(11y ago)047MITPHPPHP &gt;=5.4.0

Since Feb 27Pushed 11y ago5 watchersCompare

[ Source](https://github.com/wheniwork/oauth2-zenpayroll)[ Packagist](https://packagist.org/packages/wheniwork/oauth2-zenpayroll)[ RSS](/packages/wheniwork-oauth2-zenpayroll/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

ZenPayroll Provider for OAuth 2.0 Client
========================================

[](#zenpayroll-provider-for-oauth-20-client)

[![Build Status](https://camo.githubusercontent.com/7fa4dd8af73e44cac4fac1e91543828e7d4e0ecfafffbb4a4b5327c7c0e2f36d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7768656e69776f726b2f6f61757468322d7a656e706179726f6c6c2e737667)](https://travis-ci.org/wheniwork/oauth2-zenpayroll)[![Code Coverage](https://camo.githubusercontent.com/bd82b07a61900bc5d3cc4d1c31048e14c31192f2d8f46b601aca0277f23252b2/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7768656e69776f726b2f6f61757468322d7a656e706179726f6c6c2e737667)](https://coveralls.io/r/wheniwork/oauth2-zenpayroll)[![Code Quality](https://camo.githubusercontent.com/a5cc393edf98cc68d19da282d1fbeaefb8f55fdddb0d79e251762a3f30e90688/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7768656e69776f726b2f6f61757468322d7a656e706179726f6c6c2e737667)](https://scrutinizer-ci.com/g/wheniwork/oauth2-zenpayroll/)[![License](https://camo.githubusercontent.com/05bfa6cb9cbf9fe55198e2d54c4b6da0820d166ab59bbcd08c760d96009a4def/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7768656e69776f726b2f6f61757468322d7a656e706179726f6c6c2e737667)](https://github.com/wheniwork/oauth2-zenpayroll/blob/master/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/0e0471293a250ea49df23838f4add382674fe7fe8eb30a806091f5c46f0f5d74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768656e69776f726b2f6f61757468322d7a656e706179726f6c6c2e737667)](https://packagist.org/packages/wheniwork/oauth2-zenpayroll)

This package provides ZenPayroll OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

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

[](#installation)

To install, use composer:

```
composer require wheniwork/oauth2-zenpayroll

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `Wheniwork\OAuth2\Client\Provider\Zenpayroll` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Wheniwork\OAuth2\Client\Provider\Zenpayroll([
    'clientId'          => '{zenpayroll-client-id}',
    'clientSecret'      => '{zenpayroll-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->state;
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $userDetails = $provider->getUserDetails($token);

        // Use these details to create a new profile
        printf('Hello %s!', $userDetails->firstName);

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->accessToken;
}
```

Refreshing a Token
------------------

[](#refreshing-a-token)

```
$provider = new Wheniwork\OAuth2\Client\Provider\Zenpayroll([
    'clientId'          => '{zenpayroll-client-id}',
    'clientSecret'      => '{zenpayroll-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

$grant = new \League\OAuth2\Client\Grant\RefreshToken();
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

4089d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e47a502e778d0886033c82f584d39f1d06129973a6ed687ac6b016d1eb4e92d9?d=identicon)[dolfelt](/maintainers/dolfelt)

![](https://www.gravatar.com/avatar/e06ff0975473f7673aed90148a65feb46e290427917a07b95740e28c9bb061bc?d=identicon)[th3fallen](/maintainers/th3fallen)

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (5 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationzenpayroll

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wheniwork-oauth2-zenpayroll/health.svg)

```
[![Health](https://phpackages.com/badges/wheniwork-oauth2-zenpayroll/health.svg)](https://phpackages.com/packages/wheniwork-oauth2-zenpayroll)
```

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

GitLab OAuth 2.0 Client Provider for The PHP League OAuth2-Client

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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