PHPackages                             zbowl/food-data-central-api - 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. zbowl/food-data-central-api

ActiveLibrary[API Development](/categories/api)

zbowl/food-data-central-api
===========================

Integration for Food Data Central API

01PHP

Since Jan 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/zbowl/food-data-central-api)[ Packagist](https://packagist.org/packages/zbowl/food-data-central-api)[ RSS](/packages/zbowl-food-data-central-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Food Data Central API Wrapper
=============================

[](#food-data-central-api-wrapper)

This is a Laravel wrapper for the Food Data Central API. It is a work in progress.

Config
------

[](#config)

Publish the configuration.

```
php artisan vendor:publish --provider="zbowl\FoodDataCentral\FoodDataCentralServiceProvider" --tag="config"
```

Add environment variables to your .env.

```
FOOD_DATA_CENTRAL_BASE_URI=
FOOD_DATA_CENTRAL_API_VERSION=
FOOD_DATA_CENTRAL_API_KEY=
FOOD_DATA_CENTRAL_API_TIMEOUT=
FOOD_DATA_CENTRAL_API_RETRY_TIMES=
FOOD_DATA_CENTRAL_API_RETRY_DELAY=
```

They will be used in the food-data-central config.

```
/*
     * The base url used to for Food Data Central.
     *
     */
    'baseUri' => env('FOOD_DATA_CENTRAL_API_URI', 'https://api.nal.usda.gov/fdc'),

    /*
     * The API version provided by Food Data Central.
     *
     */
    'apiVersion' => env('FOOD_DATA_CENTRAL_API_VERSION', 'v1'),
    /*
     * The API Key provided by Food Data Central.
     * https://api.data.gov/signup/
     * https://fdc.nal.usda.gov/api-key-signup.html
     *
     */
    'apiKey' => env('FOOD_DATA_CENTRAL_API_KEY', null),
    /*
     * How long before the connection timeout.
     * Default is 10
     */
    'timeout' => env('FOOD_DATA_CENTRAL_API_TIMEOUT', 10),
    /*
     * The number of times a retry is allowed.
     * This is not used by default.
     */
    'retryTimes' => env('FOOD_DATA_CENTRAL_API_RETRY_TIMES', null),
    /*
     * The time between retry attempts in milliseconds.
     * This is not used by default.
     */
    'retryMilliseconds' => env('FOOD_DATA_CENTRAL_API_RETRY_DELAY', null),

    /*
     * The path to the migrations.
     */
    'includeMigrations' => env('FOOD_DATA_CENTRAL_API_INCLUDE_MIGRATIONS', false),
```

Usage
-----

[](#usage)

```
use zbowl\FoodDataCentralApi\Facade\FoodDataCentral;

public function search(Request $request)
{
    $request->validate([
        'query' => 'required|string',
    ]);
    $searchTerm = $request->searchInput;

    $foodDataCentral = new FoodDataCentral();
    $results = $foodDataCentral::getFoodsSearch($searchTerm);

    return view('search', compact('results'));
}

{
    $foodDataCentral = FoodDataCentral::class;
    $results = $foodDataCentral::getFoodsSearch('apple');
    return $results;
}
```

#### Resources

[](#resources)

- [Food Data Central API](https://fdc.nal.usda.gov/api-spec/fdc_api.html).
- [Data.gov](https://www.data.gov/developers/apis)

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

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/36e5bc564e2515d2d1c161e5de408883465290a15db57983ee319f7f90855b94?d=identicon)[zbowl](/maintainers/zbowl)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/zbowl-food-data-central-api/health.svg)

```
[![Health](https://phpackages.com/badges/zbowl-food-data-central-api/health.svg)](https://phpackages.com/packages/zbowl-food-data-central-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)[pixelant/pxa-social-feed

Add Facebook, Instagram, and Twitter feeds to your site.

2349.3k](/packages/pixelant-pxa-social-feed)

PHPackages © 2026

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