1. Go to this page and download the library: Download foodticket/deliveroo 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/ */
use Foodticket\Deliveroo\DeliverooApi;
$api = new DeliverooApi();
$result = $api->getOrders($brandId, $restaurantId);
// With optional filters
$result = $api->getOrders(
brandId: $brandId,
restaurantId: $restaurantId,
cursor: $result->next, // pagination cursor from previous response
startDate: Carbon::now()->subDay(),
endDate: Carbon::now(),
);
foreach ($result->orders as $order) {
// ...
}
$order = $api->getOrder($orderId);
use Foodticket\Deliveroo\Enums\OrderStatus;
use Foodticket\Deliveroo\Enums\OrderRejectReason;
// Accept an order
$api->updateOrderStatus($orderId, OrderStatus::ACCEPTED);
// Reject an order (reject reason is
use Foodticket\Deliveroo\Enums\OrderSyncStatus;
use Foodticket\Deliveroo\Enums\Reason;
// Report successful sync
$api->syncStatusOrder($orderId, OrderSyncStatus::SUCCEEDED, Carbon::now());
// Report failed sync (reason is
use Foodticket\Deliveroo\Enums\OrderStage;
$api->setOrderPreparationStage(
orderId: $orderId,
stage: OrderStage::IN_KITCHEN,
occurredAt: Carbon::now(),
);
// Optionally signal an expected delay in minutes (0, 2, 4, 6, 8, or 10)
$api->setOrderPreparationStage(
orderId: $orderId,
stage: OrderStage::READY_FOR_COLLECTION,
occurredAt: Carbon::now(),
delay: 4,
);
$brand = $api->getBrandId($locationId);
$brands = $api->getBrands();
use Foodticket\Deliveroo\DataObjects\WebhookConfiguration;
use Foodticket\Deliveroo\Enums\WebhookType;
$api->changeIntegratorWebhooksConfiguration(
brandId: $brandId,
webhookConfigurations: [
new WebhookConfiguration(
location_id: 'location-123',
orders_api_webhook_type: WebhookType::POS,
),
new WebhookConfiguration(
location_id: 'location-456',
orders_api_webhook_type: WebhookType::ORDER_EVENTS,
),
],
);
$api = new DeliverooApi();
$response = $api->request()->get('https://api.developers.deliveroo.com/order/v1/integrator/brands/{$brand_id}/sites-config');
use Foodticket\Deliveroo\DataObjects\WebhookConfiguration;
use Foodticket\Deliveroo\Enums\WebhookType;
new WebhookConfiguration(
location_id: 'location-123',
orders_api_webhook_type: WebhookType::POS,
);