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

076PHPCI passing

Since Dec 30Pushed 3mo 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 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Shop Package
====================

[](#laravel-shop-package)

[![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)[![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
```

Publish the configuration:

```
php artisan vendor:publish --provider="Blax\Shop\ShopServiceProvider"
```

Run migrations:

```
php artisan migrate
```

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)

To run the package tests:

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

The tests use an in-memory SQLite database and Orchestra Testbench.

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

[](#documentation)

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

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance54

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

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 (77 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

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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