PHPackages                             blax-software/laravel-shop - 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. blax-software/laravel-shop

ActiveLibrary[API Development](/categories/api)

blax-software/laravel-shop
==========================

A comprehensive headless e-commerce package for Laravel

1146PHPCI passing

Since Dec 30Pushed 3w agoCompare

[ Source](https://github.com/blax-software/laravel-shop)[ Packagist](https://packagist.org/packages/blax-software/laravel-shop)[ RSS](/packages/blax-software-laravel-shop/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

[![Blax Software OSS](https://raw.githubusercontent.com/blax-software/laravel-workkit/master/art/oss-initiative-banner.svg)](https://github.com/blax-software)

Laravel Shop
============

[](#laravel-shop)

[![Tests](https://github.com/blax-software/laravel-shop/actions/workflows/tests.yml/badge.svg)](https://github.com/blax-software/laravel-shop/actions/workflows/tests.yml)[![Tests Count](https://camo.githubusercontent.com/30a0e6d1ea6aa5e5aad5b502ce1ecffba8c7e62fc0e12edc3ccf581f1fb02088/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3134303925323070617373696e672d737563636573733f7374796c653d666c61742d737175617265)](#testing)[![Assertions](https://camo.githubusercontent.com/839d3a27cc1b3407b0be653a756630c1b1aae7c7e1b90065a405a0620b9759ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617373657274696f6e732d333737342d626c75653f7374796c653d666c61742d737175617265)](#testing)[![Latest Version](https://camo.githubusercontent.com/5c5ff67aa7c9097b0901ba60fc5b6ce130dcc28e189021c08e60a51d49890333/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c61782d736f6674776172652f6c61726176656c2d73686f702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/blax-software/laravel-shop)[![License](https://camo.githubusercontent.com/e20ba90e144c26f3d91746aa1ae7cc45e2db88477bd5df8bb9b57919074c524a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626c61782d736f6674776172652f6c61726176656c2d73686f702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/blax-software/laravel-shop)[![PHP Version](https://camo.githubusercontent.com/7a85d1c13ebe70e3fbae16e27e85265d7a0cdd8ebade3a448e139d21726ea5cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626c61782d736f6674776172652f6c61726176656c2d73686f702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/blax-software/laravel-shop)

A comprehensive headless e-commerce package for Laravel with stock management, Stripe integration, and product actions.

Features
--------

[](#features)

- 🛍️ **Product Management** - Simple, variable, grouped, external, booking, and pool products
- 💰 **Multi-Currency Support** - Handle multiple currencies with ease
- 📦 **Advanced Stock Management** - Stock reservations, low stock alerts, and backorders
- 💳 **Stripe Integration** - Built-in Stripe product and price synchronization
- 🎯 **Product Actions** - Execute custom actions on product events (purchases, refunds)
- 🔗 **Product Relations** - Related products, upsells, and cross-sells
- 🌍 **Translation Ready** - Built-in meta translation support
- 📊 **Stock Logging** - Complete audit trail of stock changes
- 🎨 **Headless Architecture** - Perfect for API-first applications
- ⚡ **Caching Support** - Built-in cache management for better performance
- 🛒 **Shopping Capabilities** - Built-in trait for any purchaser model
- 🎭 **Facade Support** - Clean, expressive API through Shop and Cart facades
- 👤 **Guest Cart Support** - Session-based carts for unauthenticated users

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

[](#installation)

```
composer require blax-software/laravel-shop
php artisan migrate
```

That's it — the package's migrations are auto-loaded from `vendor/` so a fresh `migrate` is all you need.

Optionally publish the config:

```
php artisan vendor:publish --tag="shop-config"
```

If you'd rather own the migrations in your own `database/migrations/` directory (e.g. to customise schemas, switch ID types, etc.):

```
php artisan vendor:publish --tag="shop-migrations"
```

To stop the package from also auto-loading them, set `'run_migrations' => false` in `config/shop.php`.

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

[](#configuration)

The main configuration file is located at `config/shop.php`. Here you can configure:

- Database table names
- Caching settings
- Stripe integration keys and settings
- Currency settings

Quick Start
-----------

[](#quick-start)

### Setup Your User Model

[](#setup-your-user-model)

Add the `HasShoppingCapabilities` trait to any model that should be able to purchase products (typically your User model):

```
use Blax\Shop\Traits\HasShoppingCapabilities;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasShoppingCapabilities;

    // ...existing code...
}
```

### Creating Your First Product

[](#creating-your-first-product)

Use the provided Enums to ensure type safety and consistency.

```
use Blax\Shop\Models\Product;
use Blax\Shop\Enums\ProductType;
use Blax\Shop\Enums\ProductStatus;
use Blax\Shop\Enums\StockType;

$product = Product::create([
    'slug' => 'amazing-t-shirt',
    'sku' => 'TSH-001',
    'type' => ProductType::SIMPLE,
    'manage_stock' => true,
    'status' => ProductStatus::PUBLISHED,
    'name' => 'Amazing T-Shirt', // Uses meta translation
    'description' => 'A comfortable cotton t-shirt',
]);

// Add Price
$product->prices()->create([
    'currency' => 'USD',
    'unit_amount' => 1999, // $19.99
    'sale_unit_amount' => 1499, // $14.99
    'is_default' => true,
]);

// Manage Stock
$product->adjustStock(StockType::INCREASE, 100); // Add 100 items to stock
$product->adjustStock(StockType::DECREASE, 10); // Remove 10 items from stock

// Reserve Stock (e.g., for a booking)
$product->adjustStock(
    StockType::CLAIMED,
    1,
    from: now(),
    until: now()->addDay(),
    note: 'Reserved for Order #123'
);
```

### Working with Cart

[](#working-with-cart)

```
use Blax\Shop\Facades\Cart;

// Add item to cart
Cart::addToCart($product, 1);

// Add item with date range (for bookings)
Cart::addToCart($product, 1, [], now(), now()->addDay());

// Checkout
$cart = Cart::getCart();
$cart->checkout(); // Creates purchases, claims stock, etc.
```

Advanced Usage
--------------

[](#advanced-usage)

### Pool Products

[](#pool-products)

Pool products are collections of single items (e.g., "Parking Spaces" containing "Spot A1", "Spot A2").

```
use Blax\Shop\Models\Product;
use Blax\Shop\Enums\ProductType;

// Create the Pool Parent
$pool = Product::create([
    'type' => ProductType::POOL,
    'name' => 'Parking Spaces',
    'manage_stock' => true, // Pool manages availability
]);

// Create Single Items
$spot1 = Product::create([
    'type' => ProductType::BOOKING,
    'name' => 'Spot A1',
]);

$spot2 = Product::create([
    'type' => ProductType::BOOKING,
    'name' => 'Spot A2',
]);

// Attach Singles to Pool
$pool->attachSingleItems([$spot1->id, $spot2->id]);
```

### Booking Products

[](#booking-products)

Booking products are time-based and require `from` and `until` dates when adding to cart.

```
use Blax\Shop\Models\Product;
use Blax\Shop\Enums\ProductType;

$room = Product::create([
    'type' => ProductType::BOOKING,
    'name' => 'Conference Room',
    'manage_stock' => true,
]);

// Check availability
$isAvailable = $room->availableOnDate(now(), now()->addHour());
```

Testing
-------

[](#testing)

We test this package for many edge cases across every surface — products, stock, pricing strategies, cart/checkout, loan lifecycle, pool aggregation, booking, Stripe sync and the event surface — so host applications can lean on the behaviour with confidence.

```
Tests: 1409, Assertions: 3774

```

CI runs the full suite on every push (see the badge above). To run it locally:

```
./vendor/bin/phpunit
```

The tests use an in-memory SQLite database and Orchestra Testbench, so they run in roughly a minute with no external services required.

Documentation
-------------

[](#documentation)

For more detailed documentation, please refer to the `docs/` directory in the repository.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

Star History
------------

[](#star-history)

[    ![Star History Chart](https://camo.githubusercontent.com/bb171a22503e7fa95c947d5d65d72fbe88cb1af17283265174e4733e133af669/68747470733a2f2f6170692e737461722d686973746f72792e636f6d2f63686172743f7265706f733d626c61782d736f6674776172652f6c61726176656c2d73686f7026747970653d64617465266c6567656e643d746f702d6c656674) ](https://www.star-history.com/?repos=blax-software%2Flaravel-shop&type=date&legend=top-left)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance62

Regular maintenance activity

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d548acfc3520e2f810e35cfb78230f885befda9fa26a3be42353723c48f991e?d=identicon)[blax-software](/maintainers/blax-software)

---

Top Contributors

[![justsomexanda](https://avatars.githubusercontent.com/u/48434066?v=4)](https://github.com/justsomexanda "justsomexanda (102 commits)")

### Embed Badge

![Health badge](/badges/blax-software-laravel-shop/health.svg)

```
[![Health](https://phpackages.com/badges/blax-software-laravel-shop/health.svg)](https://phpackages.com/packages/blax-software-laravel-shop)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k16](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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