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.
- 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?).
-
Install via composer:
composer require reliqarts/laravel-logistiq
-
Configuration & Setup:
-
Publish config file via artisan:
php artisan vendor:publish --tag=reliqarts-logistiq-config
-
The model you intend to track must implement
ReliqArts\Logistiq\Tracking\Contracts\Trackable
or extendReliqArts\Logistiq\Tracking\Models\Trackable
.e.g.
App\Order::class
:<?php // ... use ReliqArts\Logistiq\Tracking\Models\Trackable; class Order extends Trackable { // ... }
-
Create your
Status
model and implement theReliqArts\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 { // ... }
-
Configure
event_map
to fire additional events when a particularStatus
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 theProductShipped
andProductMoved
events will be fired. You have full control over what these events trigger, however each event must expect aTrackable
as the first constructor argument.
-
More on the way... 🚚
The MIT License (MIT). Please see LICENSE for more information.