Installation
composer require milestone/smartkitchen
Ensure your Laravel project meets the package’s PHP version requirements (check composer.json for constraints).
Publish Configuration
php artisan vendor:publish --provider="Milestone\SmartKitchen\SmartKitchenServiceProvider" --tag="config"
This generates config/smartkitchen.php. Review default settings (e.g., API endpoints, authentication keys).
Service Provider & Facade
Register the service provider in config/app.php under providers:
Milestone\SmartKitchen\SmartKitchenServiceProvider::class,
Use the facade for quick access:
use Milestone\SmartKitchen\Facades\SmartKitchen;
First Use Case: Fetching Kitchen Status
$status = SmartKitchen::getKitchenStatus('kitchen-123');
dd($status); // Returns array with equipment statuses (e.g., ovens, fridges)
Real-Time Equipment Monitoring
SmartKitchen::streamEquipment('kitchen-456') to listen for live updates (e.g., temperature changes, door states).SmartKitchen::onEquipmentUpdate(function ($event) {
// Log or trigger actions (e.g., alerts, maintenance schedules)
});
Order Management Integration
SmartKitchen::createOrder($orderData).$order = SmartKitchen::getOrderStatus('order-789');
if ($order->isReady()) {
notifyStaff($order);
}
Inventory Tracking
$inventory = SmartKitchen::getInventory('kitchen-123', ['flour', 'eggs']);
InventoryService (see Extension Points).config/smartkitchen.max_retries (default: 3). Adjust for high-volume kitchens.SmartKitchen::updateInventory('kitchen-123', $items)->onQueue('inventory');
config/smartkitchen.webhooks and handle them via Laravel’s HandleIncomingWebhook middleware.Authentication Errors
401 Unauthorized when calling SmartKitchen::authenticate().config/smartkitchen.api_key and ensure the key has permissions for the target kitchen(s). Test with:
php artisan smartkitchen:test-connection
Timeouts with Slow Responses
SmartKitchen::getKitchenStatus() hangs on large kitchens.config/smartkitchen.timeout (default: 10s) or fetch data in chunks using SmartKitchen::getEquipmentBatch().Event Subscription Drops
streamEquipment() disconnects intermittently.retry() helper:
SmartKitchen::streamEquipment()->retry(3, 100);
'debug' => true in config to log raw API responses to storage/logs/smartkitchen.log.--mock flag for local testing:
php artisan smartkitchen:mock --kitchen=kitchen-123
Custom Equipment Handlers
Override the default EquipmentHandler to process non-standard equipment types:
SmartKitchen::extendEquipmentHandler(function ($type, $data) {
if ($type === 'custom_grill') {
return new CustomGrill($data);
}
});
Inventory Adapters
Plug into existing inventory systems by implementing Milestone\SmartKitchen\Contracts\InventoryAdapter:
class MyInventoryAdapter implements InventoryAdapter {
public function sync($items) {
// Push to your ERP/API
}
}
Register it in config/smartkitchen.adapters.
Event Decorators Modify event payloads before they’re dispatched:
SmartKitchen::decorateEvents(function ($event) {
$event->setMetadata(['processed_at' => now()]);
});
'cache_responses' => true to cache frequent queries (e.g., kitchen status) for 5 minutes by default. Clear cache with:
php artisan cache:clear
'fallback_provider' => 'local' to use a local database if the SmartKitchen API is down.How can I help you explore Laravel packages today?