PHP code example of tims / foodlite

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

    

tims / foodlite example snippets


Foodlite::driver('zomato')->search([...]);
Foodlite::driver('zomato-pos')->confirmOrder([...]);

// config/foodlite.php
return [
    'default' => env('FOODLITE_DRIVER', 'zomato'),
    'drivers' => [
        'zomato' => [
            'user_key' => env('ZOMATO_USER_KEY'),
            'base_url' => env('ZOMATO_BASE_URL'),
            'guzzle' => [],
        ],
        'zomato-pos' => [
            'api_key' => env('ZOMATO_POS_API_KEY'),
            'base_url' => env('ZOMATO_POS_BASE_URL'),
            'api_key_header' => env('ZOMATO_POS_API_KEY_HEADER', 'api-key'),
            'guzzle' => [],
        ],
    ],
];

use Tims\Foodlite\Facades\Foodlite;

// Restaurant discovery
$results = Foodlite::driver('zomato')->search([
    'q' => 'pizza',
    'lat' => 28.6139,
    'lon' => 77.2090,
    'count' => 10,
]);

$restaurant = Foodlite::driver('zomato')->restaurant(16774318);

// POS — menu, orders, outlets
Foodlite::driver('zomato-pos')->confirmOrder([
    'order_id' => 99,
    'restaurant_id' => 123,
]);

Foodlite::driver('zomato-pos')->updateDeliveryStatus([
    'restaurant_id' => 123,
    'delivery_status' => true,
]);

use Tims\Foodlite\Facades\Foodlite;

$discovery = Foodlite::driver('zomato');
$pos = Foodlite::driver('zomato-pos');

$discovery->categories();
$pos->getDeliveryStatus(['restaurant_id' => 123]);

public function search(string $provider)
{
    abort_unless(in_array($provider, ['zomato', 'zomato-pos'], true), 404);

    return Foodlite::driver($provider)->client();
}

Foodlite::driver()->categories(); // uses FOODLITE_DRIVER / config default

$zomatoClient = Foodlite::driver('zomato')->client();      // Tims\Zomato\ZomatoClient
$posClient = Foodlite::driver('zomato-pos')->client();     // Tims\ZomatoPos\PosClient

use Tims\Foodlite\Facades\Foodlite;
use Tims\Foodlite\Drivers\AbstractDriver;

Foodlite::extend('swiggy', function ($app) {
    return new class(config('foodlite.drivers.swiggy', [])) extends AbstractDriver {
        public function getName(): string
        {
            return 'swiggy';
        }

        // your API methods…
    };
});

Foodlite::driver('swiggy');
bash
php artisan vendor:publish --tag=foodlite-config

tims/zomato-php-sdk       → Restaurant API SDK (Packagist)
tims/zomato-pos-php-sdk   → POS Integration SDK (Packagist)
tims/foodlite             → Laravel manager + drivers (Socialite-style)