PHPackages                             tonylabs/laravel-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. [API Development](/categories/api)
4. /
5. tonylabs/laravel-digikey

ActiveLibrary[API Development](/categories/api)

tonylabs/laravel-digikey
========================

Laravel package for DigiKey Product Information API V4 with OAuth2 authentication

1.1.3(6mo ago)027MITPHPPHP ^8.1

Since Sep 16Pushed 3mo agoCompare

[ Source](https://github.com/tonylabs/laravel-digikey)[ Packagist](https://packagist.org/packages/tonylabs/laravel-digikey)[ Docs](https://github.com/tonylabs/laravel-digikey)[ RSS](/packages/tonylabs-laravel-digikey/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (15)Used By (0)

Laravel DigiKey API Package
===========================

[](#laravel-digikey-api-package)

A Laravel package for integrating with the DigiKey Product Information API V4. This package provides OAuth2 authentication and comprehensive access to DigiKey's product search and information APIs.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher (optimized for Laravel 11+)
- GuzzleHTTP 7.0+

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

[](#installation)

Install the package via Composer:

```
composer require tonylabs/laravel-digikey
```

Publish the configuration file:

```
php artisan vendor:publish --provider="TONYLABS\DigiKey\DigiKeyServiceProvider"
```

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

[](#configuration)

Add your DigiKey API credentials to your `.env` file:

```
DIGIKEY_CLIENT_ID=your_client_id
DIGIKEY_CLIENT_SECRET=your_client_secret
DIGIKEY_BASE_URL=https://api.digikey.com
DIGIKEY_USE_SANDBOX=false
DIGIKEY_CUSTOMER_ID=your_customer_id
DIGIKEY_SCOPE=productinformation
```

Usage
-----

[](#usage)

### Quick Start

[](#quick-start)

```
use TONYLABS\DigiKey\DigiKey;
use TONYLABS\DigiKey\Product\SortField;
use TONYLABS\DigiKey\Product\SortOrder;

$digikey = (new DigiKey())
    ->setCategoryFilter(872)
    ->setManufacturerFilter(1904)
    ->setLocaleLanguage('en')
    ->setLocaleCurrency('USD')
    ->setLocaleSite('US')
    ->setLimit(50)
    ->setOffset(100)
    ->setOrder(SortField::QuantityAvailable, SortOrder::Descending);

$results = $digikey->searchKeyword('DCP0606QTRY');

// Per-call overrides still work as before
$results = $digikey->searchKeyword('DCP0606QTRY', [
    'limit' => 25,
    'offset' => 0,
]);

// Pure category/manufacturer browse (no keywords)
$results = (new DigiKey())
    ->setCategoryFilter(872)
    ->setManufacturerFilter(1904)
    ->setOrder(SortField::Price, SortOrder::Ascending)
    ->searchKeyword(null, [
        'limit' => 25,
    ]);
```

`setOrder()` accepts either the `SortField`/`SortOrder` enums shown above or plain strings (e.g. `'QuantityAvailable'`, `'descending'`).

Calling `new DigiKey()` reads `DIGIKEY_CLIENT_ID` and `DIGIKEY_CLIENT_SECRET` from your configuration. You can override them explicitly:

```
$digikey = new DigiKey(client_id: 'your_client_id', client_secret: 'your_client_secret');
```

The fluent helpers work alongside array payloads or `KeywordSearchRequest` instances:

```
use TONYLABS\DigiKey\Product\KeywordSearchRequest;

$request = (new KeywordSearchRequest('resistor'))
    ->setMinimumQuantityAvailable(100);

$results = (new DigiKey())->searchKeyword($request);
```

To remove previously configured helpers, call `resetFilters()`. Use `resetPagination()` to clear any fluent limit or offset. The client validates and refreshes OAuth tokens automatically through the existing `validateToken()` flow.

Locale overrides may be cleared with `resetLocale()` which reverts to the configuration defaults.

If you would rather control credentials directly, instantiate `new DigiKey(client_id: '...', client_secret: '...')` and use the instance.

### Basic Usage with Facade

[](#basic-usage-with-facade)

```
use TONYLABS\DigiKey\Facades\DigiKey;

// Search for products without constructing a request object
$results = DigiKey::searchKeyword('resistor');

// Optionally provide overrides using the same helper keys as DigiKey::searchKeyword
$stockedChips = DigiKey::searchKeyword('stm32', [
    'limit' => 50,
    'filters' => [
        'FilterOptionsRequest' => [
            'MinimumQuantityAvailable' => 25,
        ],
    ],
]);

// Get product details
$productDetails = DigiKey::getProductDetails('296-1173-1-ND');

// Get manufacturers
$manufacturers = DigiKey::getManufacturers();

// Access the lower-level array API if needed
// $raw = DigiKey::getHttpClient();
```

### OAuth2 Authentication

[](#oauth2-authentication)

The package automatically handles OAuth2 authentication using client credentials flow. Tokens are automatically obtained and cached when needed.

```
use TONYLABS\DigiKey\Services\DigiKeyOAuthService;

// Get access token (automatically cached)
$oauth = app(DigiKeyOAuthService::class);
$accessToken = $oauth->getAccessToken();

// Check if we have a valid cached token
$hasValidToken = $oauth->hasValidToken();

// Clear cached token if needed
$oauth->clearCachedToken();
```

API Methods
-----------

[](#api-methods)

- `searchKeyword(string|array|KeywordSearchRequest $search, array $options = [])` - Search for products using keywords
- `getProductDetails(string $productNumber)` - Get detailed product information
- `getManufacturers()` - Get list of manufacturers
- `getCategories()` - Get list of categories
- `getProductPricing(string $productNumber, int $quantity)` - Get product pricing
- `getRecommendedProducts(string $productNumber)` - Get recommended products
- And many more...

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance74

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Every ~3 days

Total

14

Last Release

193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fdc9b03a87407e3be07588fc060d77fb3ca5aaeb4a1dad9b4e9679c14d97d4f?d=identicon)[tonylabs](/maintainers/tonylabs)

---

Top Contributors

[![tonylabs](https://avatars.githubusercontent.com/u/34290206?v=4)](https://github.com/tonylabs "tonylabs (23 commits)")

---

Tags

apilaravelcomponentsoauth2electronicsdigikey

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/tonylabs-laravel-digikey/health.svg)

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

###  Alternatives

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

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