Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Smartkitchen Laravel Package

milestone/smartkitchen

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require milestone/smartkitchen
    

    Ensure your Laravel project meets the package’s PHP version requirements (check composer.json for constraints).

  2. 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).

  3. 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;
    
  4. First Use Case: Fetching Kitchen Status

    $status = SmartKitchen::getKitchenStatus('kitchen-123');
    dd($status); // Returns array with equipment statuses (e.g., ovens, fridges)
    

Implementation Patterns

Core Workflows

  1. Real-Time Equipment Monitoring

    • Use SmartKitchen::streamEquipment('kitchen-456') to listen for live updates (e.g., temperature changes, door states).
    • Subscribe to events in your frontend (e.g., via Laravel Echo) or process them in a queue worker:
      SmartKitchen::onEquipmentUpdate(function ($event) {
          // Log or trigger actions (e.g., alerts, maintenance schedules)
      });
      
  2. Order Management Integration

    • Sync kitchen orders with POS systems via SmartKitchen::createOrder($orderData).
    • Poll for order status updates:
      $order = SmartKitchen::getOrderStatus('order-789');
      if ($order->isReady()) {
          notifyStaff($order);
      }
      
  3. Inventory Tracking

    • Fetch ingredient stock levels:
      $inventory = SmartKitchen::getInventory('kitchen-123', ['flour', 'eggs']);
      
    • Integrate with your ERP by extending the InventoryService (see Extension Points).

Integration Tips

  • API Rate Limiting: The package respects config/smartkitchen.max_retries (default: 3). Adjust for high-volume kitchens.
  • Queue Jobs: Offload long-running tasks (e.g., bulk inventory updates) to queues:
    SmartKitchen::updateInventory('kitchen-123', $items)->onQueue('inventory');
    
  • Webhooks: For critical events (e.g., equipment failures), configure webhooks in config/smartkitchen.webhooks and handle them via Laravel’s HandleIncomingWebhook middleware.

Gotchas and Tips

Pitfalls

  1. Authentication Errors

    • Issue: 401 Unauthorized when calling SmartKitchen::authenticate().
    • Fix: Verify config/smartkitchen.api_key and ensure the key has permissions for the target kitchen(s). Test with:
      php artisan smartkitchen:test-connection
      
  2. Timeouts with Slow Responses

    • Issue: SmartKitchen::getKitchenStatus() hangs on large kitchens.
    • Fix: Increase the timeout in config/smartkitchen.timeout (default: 10s) or fetch data in chunks using SmartKitchen::getEquipmentBatch().
  3. Event Subscription Drops

    • Issue: streamEquipment() disconnects intermittently.
    • Fix: Implement exponential backoff in your reconnection logic or use Laravel’s retry() helper:
      SmartKitchen::streamEquipment()->retry(3, 100);
      

Debugging

  • Enable Logging: Set 'debug' => true in config to log raw API responses to storage/logs/smartkitchen.log.
  • Mock API Calls: Use the --mock flag for local testing:
    php artisan smartkitchen:mock --kitchen=kitchen-123
    

Extension Points

  1. 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);
        }
    });
    
  2. 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.

  3. Event Decorators Modify event payloads before they’re dispatched:

    SmartKitchen::decorateEvents(function ($event) {
        $event->setMetadata(['processed_at' => now()]);
    });
    

Config Quirks

  • Caching: Enable 'cache_responses' => true to cache frequent queries (e.g., kitchen status) for 5 minutes by default. Clear cache with:
    php artisan cache:clear
    
  • Fallbacks: Set 'fallback_provider' => 'local' to use a local database if the SmartKitchen API is down.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
babenkoivan/elastic-client
innmind/static-analysis
innmind/coding-standard
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php