PHPackages                             laratables/laravel-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. [API Development](/categories/api)
4. /
5. laratables/laravel-shipping

ActiveLibrary[API Development](/categories/api)

laratables/laravel-shipping
===========================

A weight-based shipping cost calculator for Laravel with database-driven weight bands, free shipping thresholds, flat-rate fallback and a global on/off toggle.

v1.2.0(2mo ago)02[1 issues](https://github.com/laratables/laravel-shipping/issues)MITPHPPHP ^8.2

Since Apr 4Pushed 2mo agoCompare

[ Source](https://github.com/laratables/laravel-shipping)[ Packagist](https://packagist.org/packages/laratables/laravel-shipping)[ Docs](https://github.com/laratables/laravel-shipping)[ RSS](/packages/laratables-laravel-shipping/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (10)Versions (9)Used By (0)

laratables/laravel-shipping
===========================

[](#laratableslaravel-shipping)

A weight-based shipping cost calculator for Laravel with database-driven weight bands, free shipping thresholds, flat-rate fallback, and a global on/off toggle.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, 12 or 13

> **Note for Laravel 13 users:** If you are developing on PHP 8.4 or 8.5 but deploying to a PHP 8.3 environment, add the following to your project's `composer.json` to prevent Composer pulling Symfony 8 components that require PHP 8.4:
>
> ```
> "config": {
>     "platform": {
>         "php": "8.3.0"
>     }
> }
> ```
>
>
>
> This pins dependency resolution to PHP 8.3 so Composer keeps pulling Symfony 7.4 components compatible with your server.

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

[](#installation)

```
composer require laratables/laravel-shipping
```

Publish and run the migration:

```
php artisan vendor:publish --tag=shipping-migrations
php artisan migrate
```

Publish the config file:

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

Seed the default weight bands:

```
php artisan vendor:publish --tag=shipping-seeders
php artisan db:seed --class=ShippingWeightBandSeeder
```

Usage
-----

[](#usage)

### Resolving shipping for a cart

[](#resolving-shipping-for-a-cart)

```
use Laratables\Shipping\Services\ShippingResolver;

$result = app(ShippingResolver::class)->resolve(
    cart:          session('cart', []),
    orderSubtotal: 55.00,
);

$result['total_shipping'];     // float — final charge
$result['is_free_shipping'];   // bool
$result['free_shipping_info']; // progress bar data
$result['breakdown'];          // itemised lines
```

### Cart item shape

[](#cart-item-shape)

```
[
    'product_id'    => 1,
    'name'          => 'T-Shirt',
    'weight_kg'     => 0.5,    // null to use flat rate
    'shipping_cost' => null,   // used when weight_kg is null
    'quantity'      => 2,
    'price'         => 19.99,
]
```

### Per-product priority rule

[](#per-product-priority-rule)

weight\_kgshipping\_costResultsetanyAlgorithm used, shipping\_cost ignorednullsetFlat rate used directlynullnullNot shippable, skipped### Product estimate

[](#product-estimate)

```
$estimate = app(ShippingResolver::class)->estimateForProduct(
    productId:    $product->id,
    name:         $product->name,
    weightKg:     $product->weight_kg,
    shippingCost: $product->shipping_cost,
    quantity:     1,
);
```

### Using the Facade

[](#using-the-facade)

```
use Laratables\Shipping\Facades\Shipping;

$result = Shipping::resolve(session('cart', []), $subtotal);
$info   = Shipping::freeShippingInfo($subtotal);
```

Configuration
-------------

[](#configuration)

All settings are in `config/shipping.php` and driven by environment variables:

Key.envDefaultDescription`enabled``SHIPPING_ENABLED``true`Master on/off toggle`disabled_fallback.mode``SHIPPING_DISABLED_MODE``free``free`, `flat_rate`, or `unavailable``disabled_fallback.flat_rate_amount``SHIPPING_FLAT_RATE_AMOUNT``5.99`Fixed charge when mode is `flat_rate``base_fee``SHIPPING_BASE_FEE``2.50`Handling fee on every order`multi_product_surcharge``SHIPPING_MULTI_PRODUCT_SURCHARGE``1.50`Added when cart has &gt;1 product line`heavy_item_threshold_kg``SHIPPING_HEAVY_ITEM_THRESHOLD_KG``10.0`Line weight that triggers heavy surcharge`heavy_item_surcharge``SHIPPING_HEAVY_ITEM_SURCHARGE``3.00`Charge per heavy product line`max_weight_kg``SHIPPING_MAX_WEIGHT_KG``100.0`Maximum shippable order weight`free_enabled``SHIPPING_FREE_ENABLED``true`Enable free shipping threshold`free_threshold``SHIPPING_FREE_THRESHOLD``75.00`Subtotal needed for free shipping`free_weight_limit_kg``SHIPPING_FREE_WEIGHT_LIMIT_KG``null`Max weight still eligible for free shippingWeight bands
------------

[](#weight-bands)

Bands are stored in `shipping_weight_bands` and managed from your admin panel. After updating bands, clear the cache:

```
Cache::forget('shipping_weight_bands');
```

Disabled modes
--------------

[](#disabled-modes)

```
SHIPPING_ENABLED=false
SHIPPING_DISABLED_MODE=flat_rate
SHIPPING_FLAT_RATE_AMOUNT=5.99
SHIPPING_DISABLED_MESSAGE="Flat rate shipping applied"
```

ModeBehaviour`free`All orders ship free`flat_rate`Fixed charge on every order`unavailable`Throws `RuntimeException`, block checkoutTesting
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance83

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

8

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ead92e25bfaca6770b0cb494aadd2a135bdd33d44ccde970666a94f7a110d375?d=identicon)[laratables](/maintainers/laratables)

---

Top Contributors

[![MattWiseParking](https://avatars.githubusercontent.com/u/127202190?v=4)](https://github.com/MattWiseParking "MattWiseParking (9 commits)")

---

Tags

laravelecommercecalculatorweightshipping

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laratables-laravel-shipping/health.svg)

```
[![Health](https://phpackages.com/badges/laratables-laravel-shipping/health.svg)](https://phpackages.com/packages/laratables-laravel-shipping)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
