PHPackages                             tautid/shipping - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tautid/shipping

ActiveLibrary

tautid/shipping
===============

shipping starter kit package

01.1k↓50%PHPCI failing

Since Dec 14Pushed 5mo agoCompare

[ Source](https://github.com/tautid/shipping)[ Packagist](https://packagist.org/packages/tautid/shipping)[ RSS](/packages/tautid-shipping/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Taut Shipping
=============

[](#taut-shipping)

A Laravel package for handling shipping with customizable state transitions and webhook integrations.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require tautid/shipping
```

Publish the configuration file:

```
php artisan vendor:publish --tag="taut-shipping-config"
```

Publish shippings assets:

```
php artisan vendor:publish --tag=taut-shipping-assets
```

Publish the webhook client migrations:

```
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations"
```

Publish the shipping migrations:

```
php artisan vendor:publish --tag="taut-shipping-migrations"
```

```
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config"
```

Run the migrations:

```
php artisan migrate
```

Important

**Remove the default config in webhook-client after publishing.**

This step is crucial to ensure proper configuration of the webhook client for your application.

Available Commands
------------------

[](#available-commands)

This package provides two artisan commands:

### 1. Make Transitions Command

[](#1-make-transitions-command)

Generates custom transition files for handling shipping state changes:

Customizing Shipping Transitions
--------------------------------

[](#customizing-shipping-transitions)

You can add custom business logic to shipping state changes by creating your own transition classes. This allows you to:

- Send notifications when shipping are completed
- Update related models when shipping status changes
- Log shipping activities for audit trails
- Integrate with third-party services
- Execute custom business rules

### Creating Custom Transitions

[](#creating-custom-transitions)

Use the provided command to generate transition files:

```
php artisan taut-shipping:make-transitions
```

This will create the following transition files in your `app/Transitions/Shipping/` directory:

- `ToDraft.php` - Executed when shipping is draft
- `ToRequested.php` - Executed when shipping is requested to driver
- `ToDelivering.php` - Executed when shipping becomes delivering
- `ToCanceled.php` - Executed when shipping is canceled
- `ToFailed.php` - Executed when shipping becomes failed
- `ToLost.php` - Executed when shipping becomes lost (package lost)
- `ToReturned.php` - Executed when shipping is returned
- `ToDelivered.php` - Executed when shipping is completed

### Example Custom Transition

[](#example-custom-transition)

Each transition file extends the `ShippingTransitionAbstract` class. Here's an example of customizing the `ToDelivered` transition:

```
