PHP code example of fritak / tesco-api-php

1. Go to this page and download the library: Download fritak/tesco-api-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/ */

    

fritak / tesco-api-php example snippets


// For Grocery
$api = new TescoApi(new Config('first_key', 'second_key'));

// Find product based on you QUERY.
$result = $api->findGroceryProduct('pizza');

foreach($result->getProducts() AS $product)
{
    // your code for product...
}

// Find product based on you QUERY with limit 25, starting on 10.
$result = $api->findGroceryProduct('pizza', 25, 10);

// Total products
$result->getGrocery()->products->totals->all;

composer