roundly-consulting / shops-for-laravel
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!
Requires
- php: ^8.4
- ext-bcmath: *
- illuminate/contracts: ^12.0|^13.0
- roundly-consulting/addresses-for-laravel: ^1.0
- roundly-consulting/attributes-for-laravel: ^1.0
- roundly-consulting/coupons-for-laravel: ^1.0
- roundly-consulting/credits-for-laravel: ^1.0
- roundly-consulting/enums-for-laravel: ^1.0
- roundly-consulting/media-library-for-laravel: ^1.0
- roundly-consulting/money-for-laravel: ^1.0
- roundly-consulting/package-toolkit-for-laravel: ^1.0
- roundly-consulting/reviews-for-laravel: ^1.0
- roundly-consulting/sluggable-for-laravel: ^1.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- roundly-consulting/testing-for-laravel: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
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.
License
The MIT License (MIT). Please see License File for more information.