1. Go to this page and download the library: Download laratables/laravel-shipping library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laratables / laravel-shipping example snippets
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
[
'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,
]