PHPackages                             chadhutchins/oauth2-zoho - 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. chadhutchins/oauth2-zoho

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

chadhutchins/oauth2-zoho
========================

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

v1.0(6y ago)01441MITPHPPHP &gt;=5.5.0CI failing

Since Mar 3Pushed 6y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Zoho Online Provider for OAuth 2.0 Client
=========================================

[](#zoho-online-provider-for-oauth-20-client)

[![Latest Stable Version](https://camo.githubusercontent.com/b214b7f66637a8e0375074ef4c33fea868b1246162f65e2a819b91b0a41c40c2/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d7a6f686f2f762f737461626c65)](https://packagist.org/packages/chadhutchins/oauth2-zoho)[![Total Downloads](https://camo.githubusercontent.com/d86d7b3317d90c8362ef1b5b1384f3c3eb825ae906d7500bb84595dcded1ecb7/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d7a6f686f2f646f776e6c6f616473)](https://packagist.org/packages/chadhutchins/oauth2-zoho)[![License](https://camo.githubusercontent.com/ff0d1a9780b934c52d4620c2c3661678c44938496993fd7eca04eef4e82a904f/68747470733a2f2f706f7365722e707567782e6f72672f636861646875746368696e732f6f61757468322d7a6f686f2f6c6963656e7365)](https://packagist.org/packages/chadhutchins/oauth2-zoho)[![Build Status](https://camo.githubusercontent.com/dd826b6b51b50feb90df45ad5b46738f5ad87062c8a0fe3b6e3fdc644c4e8a0b/68747470733a2f2f7472617669732d63692e6f72672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d7a6f686f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/multidimension-al/oauth2-zoho)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/116a6c8ed72051bfa5197c64fec744ade1c990d90a4d4244b812cd662c82e8ac/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d756c746964696d656e73696f6e2d616c2f6f61757468322d7a6f686f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/multidimension-al/oauth2-zoho/?branch=master)

This package provides Zoho 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 chadhutchins/oauth2-zoho

```

### Usage

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

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

if (!isset($_GET['code'])) {
    $options = [
        'scope' => ['com.intuit.zoho.accounting'] // array or string
    ];

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl($options);
    $_SESSION['oauth2state'] = $provider->getState();
    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
        $user = $provider->getResourceOwner($token);

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

    } catch (Exception $e) {

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

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

### Managing Scopes

[](#managing-scopes)

When creating your Zoho authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['read_orders','write_orders'] // array or string
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, the [following scopes are available](https://www.zoho.com/crm/developer/docs/api/oauth-overview.html).

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/chadhutchins/oauth2-zoho/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Nile Suan](https://github.com/nilesuan)
- [All Contributors](https://github.com/chadhutchins/oauth2-zoho/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/chadhutchins/oauth2-zoho/blob/master/LICENSE) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

2267d ago

### Community

Maintainers

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

---

Top Contributors

[![chadhutchins](https://avatars.githubusercontent.com/u/47898?v=4)](https://github.com/chadhutchins "chadhutchins (2 commits)")

---

Tags

clientoauthoauth2authorizationZoho

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/chadhutchins-oauth2-zoho/health.svg)

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

###  Alternatives

[league/oauth2-google

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

42121.2M118](/packages/league-oauth2-google)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[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)
