PHPackages                             api-skeletons/zf-oauth2-client - 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. api-skeletons/zf-oauth2-client

ActiveLibrary[API Development](/categories/api)

api-skeletons/zf-oauth2-client
==============================

An OAuth2 client for zfcampus/zf-oauth2

1.0.1(10y ago)42.8k3BSD-3-ClausePHPPHP &gt;=5.5

Since May 8Pushed 9y ago2 watchersCompare

[ Source](https://github.com/API-Skeletons/zf-oauth2-client)[ Packagist](https://packagist.org/packages/api-skeletons/zf-oauth2-client)[ RSS](/packages/api-skeletons-zf-oauth2-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (15)Versions (5)Used By (0)

ZF OAuth2 Client
================

[](#zf-oauth2-client)

[![Build Status](https://camo.githubusercontent.com/f7f8a85774cb207971ceba3dd3cf6da0207b991975abc9491cee1b3d2750d4bb/68747470733a2f2f7472617669732d63692e6f72672f4150492d536b656c65746f6e732f7a662d6f61757468322d636c69656e742e7376673f6272616e63683d302e312e30)](https://travis-ci.org/API-Skeletons/zf-oauth2-client)[![Coverage Status](https://camo.githubusercontent.com/3b1a9a36130a648862fa8c4110edabd0b5f3d06f32565b1a88ac41324694938e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f4150492d536b656c65746f6e732f7a662d6f61757468322d636c69656e742f62616467652e737667)](https://coveralls.io/r/API-Skeletons/zf-oauth2-client)[![Total Downloads](https://camo.githubusercontent.com/ce6ce1b938d924bf25cddc809b193e686c8d8e5b8c367c945661fa4ec83be7b9/68747470733a2f2f706f7365722e707567782e6f72672f7a6663616d7075732f7a662d6f61757468322d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/zfcampus/zf-oauth2-client)

When you write an application which includes [zfcampus/zf-oauth2](https://github.com/zfcampus/zf-oauth2)this module is written to connect easily and cleanly connect to that zf-oauth2 implementation.

Install
-------

[](#install)

Installation of this module uses composer. For composer documentation, please refer to [getcomposer.org](http://getcomposer.org/).

```
composer require api-skeletons/zf-oauth2-client ^1.0
```

Add this module to your application's configuration:

```
'modules' => array(
   ...
   'ZF\OAuth2\Client',
),
```

This module provides the service manager config through the module but you may use the `ZF\OAuth2\Client\OAuth2Client` class directly by injecting your own `Zend\Http\Client` and configuration.

Configuration
-------------

[](#configuration)

Copy `config/zf-oauth2-client.global.php.dist` to `config/autoload/zf-oauth2-client-global.php` and edit. You may configure multiple zf-oauth2 authorization code provider profiles. login\_redirect\_route is your authentication route.

```
    'zf-oauth2-client' => array(
        'profiles' => array(
            'default' => array(
                'login_redirect_route' => 'zfcuser',
                'client_id' => 'client',
                'secret' => 'password',
                'endpoint' => 'http://localhost:8081/oauth',
                'refresh_endpoint' => 'http://localhost:8081/oauth',
                'scope' = 'list,of,scopes',
            ),
            /* 'other provider' => array( ... */
        ),
    ),
```

zf-oauth2 Server Configuration
------------------------------

[](#zf-oauth2-server-configuration)

zf-oauth2-client expects the server to return a new refresh token anytime a refresh token is used to get a new access token. To set this flag on zf-oauth2 use

```
return array(
    'zf-oauth2' => array(
        'options' => array(
            'always_issue_new_refresh_token' => true,
        ),
    ),
);
```

Use
---

[](#use)

A controller is provided to send the user into the authorization code process and validate the code when the user returns. Upon validation the session will have a valid access\_token.

To send a user into the authorization code process direct them to the zf-oauth2-client route.

```
// Controller
$this->plugin('redirect')
    ->toRoute('zf-oauth2-client', array('profile' => 'default'));

// View
$this->url('zf-oauth2-client', array('profile' => 'default'));
```

When the user returns from the process they will be redirected to the login\_redirect\_route. This route should fetch an authorized http client and, using it, authenticate the user based on their profile returned from an API call back to the OAuth2 server.

Command Line Tools
------------------

[](#command-line-tools)

To make JWT easier to test command line tools are included.

- `oauth2:jwt:generate` Generate a JWT to send to an OAuth2 `grant_type` of `urn:ietf:params:oauth:grant-type:jwt-bearer`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~54 days

Total

4

Last Release

3854d ago

Major Versions

0.1.1 → 1.0.02015-10-18

PHP version history (2 changes)0.1.0PHP &gt;=5.3.23

1.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/49dd7d9dba889ac674b0da447d9c1e69d1128dc3ccbaef98ba83d6ee519fc2d6?d=identicon)[tom\_anderson](/maintainers/tom_anderson)

---

Top Contributors

[![TomHAnderson](https://avatars.githubusercontent.com/u/493920?v=4)](https://github.com/TomHAnderson "TomHAnderson (20 commits)")

---

Tags

apioauth2

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/api-skeletons-zf-oauth2-client/health.svg)

```
[![Health](https://phpackages.com/badges/api-skeletons-zf-oauth2-client/health.svg)](https://phpackages.com/packages/api-skeletons-zf-oauth2-client)
```

###  Alternatives

[weble/zohoclient

Zoho API Client for oAuth auth and common tasks - PHP SDK

11145.6k3](/packages/weble-zohoclient)[evandotpro/edp-github

Github API integration module for Zend Framework 2

241.6k](/packages/evandotpro-edp-github)

PHPackages © 2026

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