PHP code example of openfoodfacts / openfoodfacts-php

1. Go to this page and download the library: Download openfoodfacts/openfoodfacts-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openfoodfacts / openfoodfacts-php example snippets


$api = new OpenFoodFacts\Api('food','fr');
$product = $api->getProduct('3057640385148');

$product = $api->getProduct('3057640385148');
$productDataAsArray = $product->getData();
bash
composer