reliqarts/laravel-logistiq

This package is abandoned and no longer maintained. No replacement package was suggested.

Multi-purpose tracking/logistics package for Laravel.

v0.0.1 2019-07-12 14:42 UTC

This package is auto-updated.

Last update: 2020-12-14 20:16:49 UTC


README

Multi-purpose tracking/logistics package for Laravel

Logistiq is a plug-and-play tracking package which allows you to track any trackable entity (i.e. orders, shipments, etc.) It is highly-configurable and easy to use.

Built For Laravel License Build Status (all) Scrutinizer Codecov Latest Stable Version

Key Features

  • Track any eloquent model through different user-defined statuses.
  • Configure one or more events to be fired when a model enters any user-defined status.
  • Supports laravel-event-projector in case you're using Event Sourcing (What's this?).

Installation & Usage

  1. Install via composer:

    composer require reliqarts/laravel-logistiq
  2. Configuration & Setup:

    1. Publish config file via artisan:

      php artisan vendor:publish --tag=reliqarts-logistiq-config
    2. The model you intend to track must implement ReliqArts\Logistiq\Tracking\Contracts\Trackable or extend ReliqArts\Logistiq\Tracking\Models\Trackable.

      e.g. App\Order::class:

      <?php
      
      // ...
      
      use ReliqArts\Logistiq\Tracking\Models\Trackable;
      
      class Order extends Trackable
      {
          // ...
      }
    3. Create your Status model and implement the ReliqArts\Logistiq\Tracking\Contracts\Status contract therein.

      e.g. App\Status::class:

      <?php
      
      // ...
      
      use ReliqArts\Logistiq\Utility\Eloquent\Model;
      use ReliqArts\Logistiq\Tracking\Contracts\Status as LogistiqStatusContract;
      
      class Status extends Model implements LogistiqStatusContract
      {   
          // ...
      }
    4. Configure event_map to fire additional events when a particular Status is hit.

      e.g. excerpt from /config/reliqats-logistiq:

      <?php
      
      // ...
      
      'event_map' => [
          '230c6c51-3b5b-4eea-9ef2-415e4d8fee00' => [ProductShipped::class, ProductMoved::class]
      ],
      
      // ...

      Explanation: With the above snipped of code, whenever the Status with identifier 230c6c51-3b5b-4eea-9ef2-415e4d8fee00 is reached by a trackable model the ProductShipped and ProductMoved events will be fired. You have full control over what these events trigger, however each event must expect a Trackable as the first constructor argument.

More on the way... 🚚

License

The MIT License (MIT). Please see LICENSE for more information.