PHPackages                             bggardner/oauth2-digikey - 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. bggardner/oauth2-digikey

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

bggardner/oauth2-digikey
========================

Digi-Key OAuth 2.0 Client Provider for the PHP League OAuth2-Client

01.2k↑125%PHP

Since Dec 10Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Digi-Key Provider for OAuth 2.0 Client
======================================

[](#digi-key-provider-for-oauth-20-client)

This package provides Digi-Key OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client) for use in accessing [Digi-Key API Solutions](https://developer.digikey.com/).

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

[](#installation)

To install, use composer:

```
composer require bggardner/oauth2-digikey:dev-master

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Bggardner\OAuth2\Client\Provider\DigiKey([
    'clientId'          => '{digikey-client-id}',
    'clientSecret'      => '{digikey-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'isSandbox'         => true, // Optional, defaults to false. When true, client uses sandbox urls.
    'localeSite'        => 'US', // Optional, defaults to null. Two letter code for Digi-Key product website to search on.
    'localeLanguage'    => 'en', // Optional, defaults to null. Two letter code for language to search on. Language must be supported by the selected site.
    'localeCurrency'    => 'USD', // Optional, defaults to null. Three letter code for Currency to return part pricing for. Currency must be supported by the selected site.
    'customerId'        => '{digikey-customer-id}', // Optional, defaults to null. Your Digi-Key Customer id. If your account has multiple Customer Ids for different regions, this allows you to select one of them.
]);
```

For further usage of this package please refer to the [core package documentation on "Authorization Code Grant"](https://github.com/thephpleague/oauth2-client#usage).

### Refreshing a Token

[](#refreshing-a-token)

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

$accessToken = getAccessTokenFromYourDataStore();

if ($accessToken->hasExpired()) {
    $accessToken = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $accessToken->getRefreshToken()
    ]);

    // Purge old access token and store new access token to your data store.
}
```

For further usage of this package please refer to the [core package documentation on "Refreshing a Token"](https://github.com/thephpleague/oauth2-client#refreshing-a-token).

### Making an API call

[](#making-an-api-call)

The example below makes a request to the [Product Details API](https://developer.digikey.com/products/product-information/partsearch/productdetails):

```
$request = $provider->getAuthenticatedRequest(
    'GET',
    'https://api.digikey.com/Search/v3/Products/{digikey-part-number}',
    $accessToken
);

# Response returns an associative array
$response = $provider->getParsedResponse($request);
```

License
-------

[](#license)

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

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/61ad7e46f613fe81d11ee84ddd2c1220597ff3089d1317d3d682cd2bc05dbacc?d=identicon)[bggardner](/maintainers/bggardner)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/bggardner-oauth2-digikey/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M119](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)

PHPackages © 2026

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