Skip to content

A simple implementation of a shipment/item tracker made with Laravel and Livewire. 📦

License

Notifications You must be signed in to change notification settings

jj15asmr/laravel-shipment-tracker-example

Repository files navigation

📦 Laravel Shipment Tracker Example

This is a simple implementation of a shipment/item tracker, similar to the ones provided by USPS, FedEx, UPS, etc. I started creating it as a little "practice project" over this past Memorial Day weekend.

As the name suggests, it's built with Laravel (v10.12.0) as well as Livewire. Bootstrap 5 is used for the design.

It provides a single route (there is no admin panel or the like) to a full-page Livewire component where you are able to enter the tracking number of an item and...

  • View it's current status (Picked Up, In Transit, Dispatched, or Delivered) on a nice-looking progress bar. An item can also have the status of "In System" (meaning that the item isn't yet in the possession of the courier service) which will show an alert instead.

  • View the details of the sender and receiver as well as the item's details (ship date, shipment type, weight).

  • View the item's "tracking events", such as where/when the item was picked up, delivered, etc.

  • The tab title also changes to reflect the item's status and it's tracking number.

This project is licensed under the MIT License - see the LICENSE file for details.

Installation

  1. Download (and extract) or clone this project's repository to your local machine or server.

  2. Enter the project's directory and via the terminal execute the following commands:

    composer install
    
    cp .env.example .env
    
    php artisan key:generate
  3. In the .env file ensure that your database details are correct and then run the below command:

    php artisan migrate --seed

    Your database should now be filled with the required tables and 6 items/shipments with up to 12 tracking events (if their status is other than "In System").

  4. Lastly, ensure that the APP_URL and ASSET_URL keys in the .env file are correct for your case and then run the below command to host the project locally on your machine:

    php artisan serve

    Go to the URL given in your browser and you should be all set! Pick a tracking number from the DB to lookup and have fun.

Running Tests

This project, as any good one should 😉, includes automated tests powered by PHPUnit. You can run them by running the below command:

php artisan test --order-by random

If you'd like to view or edit the tests you can find them all within the tests/Feature directory, organized accordingly.

Any tests that involve the DB are configured to use an in-memory SQLite database, if you'd like to change this, you can do so in the phpunit.xml file in the project's root.

Credits

I built this project using these awesome things made by awesome people, here's a big thanks to them:

Extra Notes

I've only been working with Laravel for about 6 months now so I'm still a beginner. 😁 If you spot anything wrong with my code or it's design then please feel free to submit an issue or PR.

Also, if you're curious about what "PoŝtaLoĝistiko" means, it's Esperanto for "Postal Logistics" (or it's supposed to be, I used Google Translate...) I just thought it sounded "cool".

About

A simple implementation of a shipment/item tracker made with Laravel and Livewire. 📦

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published