### Install Shops for Laravel with Composer and Artisan Source: https://github.com/roundly-consulting/shops-for-laravel/blob/main/README.md Install the package and publish migrations. Requires PHP 8.4 with ext-bcmath and Laravel 12 or 13. Set SHOPS_KEY_TYPE before migrating if using UUID/ULID keys, and configure sluggable.locales.supported before migrating for slug indexes. ```bash 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 ``` -------------------------------- ### Create a product and receive inventory Source: https://github.com/roundly-consulting/shops-for-laravel/blob/main/README.md Creates a product with a default variant, sets its price using Money::ofMinor, and receives stock via Shops::inventory()->receive(). Every product is created with a default variant. ```php 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'); ``` -------------------------------- ### Cart, checkout, charge, and fulfil an order Source: https://github.com/roundly-consulting/shops-for-laravel/blob/main/README.md Adds items to a cart, checks out with a shipping address (reserving stock and firing OrderPlaced), then charges and fulfils the order. The price shown is tax included. ```php 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 ```