GithubHelp home page GithubHelp logo

reliqarts / laravel-logistiq Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 99 KB

Multi-purpose tracking/logistics package for Laravel

License: MIT License

PHP 100.00%
tracking package parcel event status utility

laravel-logistiq's Introduction

Laravel Logistiq

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.

laravel-logistiq's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

asiellb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.