{"id":33990391,"url":"https://github.com/wheniwork/oauth2-zenpayroll","last_synced_at":"2026-05-24T23:35:20.846Z","repository":{"id":27937974,"uuid":"31430500","full_name":"wheniwork/oauth2-zenpayroll","owner":"wheniwork","description":"ZenPayroll provider for the OAuth 2.0 Client","archived":false,"fork":false,"pushed_at":"2015-03-06T21:36:10.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-14T18:12:00.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wheniwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-27T17:22:32.000Z","updated_at":"2015-03-06T21:36:11.000Z","dependencies_parsed_at":"2022-08-24T13:10:23.039Z","dependency_job_id":null,"html_url":"https://github.com/wheniwork/oauth2-zenpayroll","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wheniwork/oauth2-zenpayroll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-zenpayroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-zenpayroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-zenpayroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-zenpayroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wheniwork","download_url":"https://codeload.github.com/wheniwork/oauth2-zenpayroll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheniwork%2Foauth2-zenpayroll/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33455025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T19:21:36.376Z","status":"ssl_error","status_checked_at":"2026-05-24T19:21:10.562Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-13T06:11:42.965Z","updated_at":"2026-05-24T23:35:20.825Z","avatar_url":"https://github.com/wheniwork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZenPayroll Provider for OAuth 2.0 Client\n\n[![Build Status](https://img.shields.io/travis/wheniwork/oauth2-zenpayroll.svg)](https://travis-ci.org/wheniwork/oauth2-zenpayroll)\n[![Code Coverage](https://img.shields.io/coveralls/wheniwork/oauth2-zenpayroll.svg)](https://coveralls.io/r/wheniwork/oauth2-zenpayroll)\n[![Code Quality](https://img.shields.io/scrutinizer/g/wheniwork/oauth2-zenpayroll.svg)](https://scrutinizer-ci.com/g/wheniwork/oauth2-zenpayroll/)\n[![License](https://img.shields.io/packagist/l/wheniwork/oauth2-zenpayroll.svg)](https://github.com/wheniwork/oauth2-zenpayroll/blob/master/LICENSE)\n[![Latest Stable Version](https://img.shields.io/packagist/v/wheniwork/oauth2-zenpayroll.svg)](https://packagist.org/packages/wheniwork/oauth2-zenpayroll)\n\nThis package provides ZenPayroll OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).\n\n## Installation\n\nTo install, use composer:\n\n```\ncomposer require wheniwork/oauth2-zenpayroll\n```\n\n## Usage\n\nUsage is the same as The League's OAuth client, using `Wheniwork\\OAuth2\\Client\\Provider\\Zenpayroll` as the provider.\n\n### Authorization Code Flow\n\n```php\n$provider = new Wheniwork\\OAuth2\\Client\\Provider\\Zenpayroll([\n    'clientId'          =\u003e '{zenpayroll-client-id}',\n    'clientSecret'      =\u003e '{zenpayroll-client-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url'\n]);\n\nif (!isset($_GET['code'])) {\n\n    // If we don't have an authorization code then get one\n    $authUrl = $provider-\u003egetAuthorizationUrl();\n    $_SESSION['oauth2state'] = $provider-\u003estate;\n    header('Location: '.$authUrl);\n    exit;\n\n// Check given state against previously stored one to mitigate CSRF attack\n} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {\n\n    unset($_SESSION['oauth2state']);\n    exit('Invalid state');\n\n} else {\n\n    // Try to get an access token (using the authorization code grant)\n    $token = $provider-\u003egetAccessToken('authorization_code', [\n        'code' =\u003e $_GET['code']\n    ]);\n\n    // Optional: Now you have a token you can look up a users profile data\n    try {\n\n        // We got an access token, let's now get the user's details\n        $userDetails = $provider-\u003egetUserDetails($token);\n\n        // Use these details to create a new profile\n        printf('Hello %s!', $userDetails-\u003efirstName);\n\n    } catch (Exception $e) {\n\n        // Failed to get user details\n        exit('Oh dear...');\n    }\n\n    // Use this to interact with an API on the users behalf\n    echo $token-\u003eaccessToken;\n}\n```\n\n## Refreshing a Token\n\n```php\n$provider = new Wheniwork\\OAuth2\\Client\\Provider\\Zenpayroll([\n    'clientId'          =\u003e '{zenpayroll-client-id}',\n    'clientSecret'      =\u003e '{zenpayroll-client-secret}',\n    'redirectUri'       =\u003e 'https://example.com/callback-url'\n]);\n\n$grant = new \\League\\OAuth2\\Client\\Grant\\RefreshToken();\n$token = $provider-\u003egetAccessToken($grant, ['refresh_token' =\u003e $refreshToken]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheniwork%2Foauth2-zenpayroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwheniwork%2Foauth2-zenpayroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheniwork%2Foauth2-zenpayroll/lists"}