PHPackages                             ccharz/laravel-openfoodfacts-reader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ccharz/laravel-openfoodfacts-reader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ccharz/laravel-openfoodfacts-reader
===================================

Get Openfoodfacts Product Infos

v0.1.0(1y ago)03MITPHPPHP ^8.2CI passing

Since Jan 7Pushed 1y ago1 watchersCompare

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

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

Laravel Openfoodfacts Reader
============================

[](#laravel-openfoodfacts-reader)

Introduction
------------

[](#introduction)

Get product data from openfoodsfacts with a local driver and an api driver.

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

[](#requirements)

Laravel Openfoodfacts Reader requires PHP 8.2+ and Laravel 10.

If you use the local driver currently around 50 GB of disk space are required.

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

[](#installation)

Install the package by

```
composer require ccharz/laravel-openfoodfacts-reader

```

Drivers
-------

[](#drivers)

### Local

[](#local)

This driver uses data imported from the official jsonl export from openfoodfacts. Keep in mind that the decompressed files has ~3.5 Million Products and take up to 50GB of storage at the moment.

#### Setup

[](#setup)

First publish the migrations using

```
php artisan vendor:publish --tag openfoodfactsreader-migrations

```

Run `php artisan migrate` to migrate your database.

#### Import Database

[](#import-database)

1. Download the current database jsonl from .
2. Decompress the downloaded file (for example using gunzip `gunzip openfoodfacts-products.jsonl.gz`)
3. Import the file into the database using the artisan command

```
php artisan openfoodfactsreader:import openfoodfacts-products.jsonl

```

(asserting the decompressed file exists in the root folder of your application).

#### Using your own model

[](#using-your-own-model)

```
namespace App\Models;

use Ccharz\LaravelOpenfoodfactsReader\Driver\Local\OpenfoodfactsProduct as BaseOpenfoodfactsProduct;

class OpenfoodfactsProduct extends BaseOpenfoodfactsProduct
{
...
```

In the config file of the package you can specify your class:

```
// config/openfoodfactsreader.php
...
   'model' => App\Models\OpenfoodfactsProduct::class
...
```

### API V2

[](#api-v2)

This driver uses the official v2 api.

#### Setup

[](#setup-1)

Publish the configuration using

```
php artisan vendor:publish --tag openfoodfactsreader-config
```

and set the user agent. The User-Agent should be in the form of AppName/Version (ContactEmail). For example, MyApp/1.0 ().

Usage
-----

[](#usage)

### Get Product Data By Barcode

[](#get-product-data-by-barcode)

```
/** @var Ccharz\LaravelOpenfoodfactsReader\Driver\Local\OpenfoodfactsProduct $product */
$product = app(LaravelOpenfoodfactsReader::class)->product('737628064502');
```

You can access the product data via the `data` method of the OpenfoodfactsProduct Model.

### Driver Selection

[](#driver-selection)

You can either use the default driver configured in the config file or specify it using the **driver** method.

```
app(LaravelOpenfoodfactsReader::class)->driver('local')->product('737628064502');
app(LaravelOpenfoodfactsReader::class)->driver('v2')->product('737628064502');
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance44

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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 ~417 days

Total

2

Last Release

438d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelopenfoodfactsphp8phplaravelopenfoodfacts

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ccharz-laravel-openfoodfacts-reader/health.svg)

```
[![Health](https://phpackages.com/badges/ccharz-laravel-openfoodfacts-reader/health.svg)](https://phpackages.com/packages/ccharz-laravel-openfoodfacts-reader)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[monicahq/laravel-cloudflare

Add Cloudflare ip addresses to trusted proxies for Laravel.

3372.7M4](/packages/monicahq-laravel-cloudflare)[mediconesystems/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

1.2k711.3k8](/packages/mediconesystems-livewire-datatables)[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

188402.3k6](/packages/kra8-laravel-snowflake)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)

PHPackages © 2026

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