Search by

roundly-consulting / shops-for-laravel

mihaliak

Manage single or multiple shops with products, categories, and orders in Laravel.

Package info

github.com/roundly-consulting/shops-for-laravel

pkg:composer/roundly-consulting/shops-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0


README

Shops for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Shops for Laravel

A production-grade e-commerce foundation for Laravel: products with variants and options, a race-safe inventory ledger with stock reservations, a persistent cart with one-call checkout, a guarded order state machine and exact net/gross tax pricing on arbitrary-precision money. Catalog media, reviews, spec sheets, coupons, store credit and address books come from sibling Roundly packages; payment and shipping are driver contracts you bind.

Installation

Requires PHP 8.4 (ext-bcmath) and Laravel 12 or 13.

composer require roundly-consulting/shops-for-laravel
php artisan vendor:publish --tag="shops-migrations"
php artisan vendor:publish --tag="media-migrations" --tag="reviews-migrations" --tag="attributes-migrations" \
    --tag="coupons-migrations" --tag="credits-migrations" --tag="addresses-migrations"
php artisan migrate

If your customer or cart-owner models have UUID/ULID keys, set SHOPS_KEY_TYPE before migrating; slug indexes are created for each locale in sluggable.locales.supported, so set it first too.

Usage

Stock a product — every product is created with a default variant:

use RoundlyConsulting\Money\Money;
use RoundlyConsulting\Shops\Facades\Shops;
use RoundlyConsulting\Shops\Products\Product;

$product = Product::create(['name' => 'Sparkling Water']);

$variant = $product->defaultVariant;
$variant->update(['price' => Money::ofMinor(199, 'EUR')]);

Shops::inventory($variant)->receive(50, note: 'Opening stock');

Then sell it — cart, checkout, payment and fulfilment:

use RoundlyConsulting\Shops\Cart\Cart;
use RoundlyConsulting\Shops\Orders\DataTransferObjects\Address;
use RoundlyConsulting\Shops\Orders\DataTransferObjects\PlaceOrderData;

$cart = Cart::create(['currency' => 'EUR']);
Shops::cart($cart)->add($variant, 2);
Shops::cart($cart)->price()->getFinalPrice();   // 3.98 EUR, tax included

$order = Shops::cart($cart)->checkout(new PlaceOrderData(
    shipping: new Address('Ada Lovelace', '1 Analytical Way', 'London', 'EC1A 1AA', 'GB'),
));                                             // stock reserved, cart emptied, OrderPlaced fired

Shops::order($order)->charge();                 // through your PaymentGateway → Paid
Shops::order($order)->fulfil();                 // the reservation becomes a sale

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/shops-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.