Download the PHP package aliziodev/laravel-product-catalog without Composer
On this page you can find all versions of the php package aliziodev/laravel-product-catalog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aliziodev/laravel-product-catalog
More information about aliziodev/laravel-product-catalog
Files in aliziodev/laravel-product-catalog
Package laravel-product-catalog
Short Description A professional, variant-centric product catalog package for Laravel. Covers product catalog, online store, ecommerce, internal catalog, digital & physical products, and custom inventory integration.
License MIT
Homepage https://github.com/aliziodev
Informations about the package laravel-product-catalog

A professional, variant-centric product catalog package for Laravel 12+. Designed to be a stable foundation for any application that needs structured product data — from a simple internal catalog to a full ecommerce storefront — without locking you into a specific architecture.
Table of Contents
- Suitable For
- Features
- Installation
- Configuration
- Basic Usage
- Products
- Variants & Options
- Inventory
- Taxonomy
- Querying
- Product Specifications
- Slug Routing
- API Resources
- Events
- Inventory Policies
- Spatie Media Library Integration
- Custom Inventory Driver
- Use-Case Docs
Suitable For
| Use Case | Description |
|---|---|
| Product Catalog | Display products with filtering, search, and SEO-friendly slug routing |
| Online Store | Storefront with prices, discount badges, per-variant stock, and cart-ready data |
| Simple Ecommerce | Order integration with reserve/release stock and an audit trail of stock movements |
| Internal Catalog | Internal product database with product codes, cost prices, and custom metadata |
| Digital & Physical | Mixed catalog — physical variants (tracked stock) and digital (unlimited) in one product |
| Custom Inventory | Stock already managed externally (ERP, WMS, your own table) — connect it via a single interface |
Features
Catalog
- Products with lifecycle status:
draft→published→archived - Product code (
code) as the parent SKU; per-variant SKUs for child variants - Permanent slug routing — URLs stay valid even when the product name changes
ProductSearchBuilder— fluent catalog-aware search with filters for category, brand, tags, price range, and stock statusfromRequest()— map HTTP query-string params to the builder in one line- Text search via LIKE (zero config) or MySQL FULLTEXT (opt-in via
search.fulltext = true) - Scout integration — plug in Algolia, Meilisearch, or Typesense via
ScoutSearchDriver - Taxonomy: Brand, Category (parent–child hierarchy), Tag — all with soft delete
Variants & Options
ProductVariantas the primary sellable unit, not Product- String-based options (Color, Size, etc.) with no separate master table required
- Auto-generated label from combined option values:
"Red / XL" - Auto-generate SKU from product code + option values
- Sale price, compare price (discount), and cost price per variant
- Physical dimensions (weight, length, width, height) for shipping calculation
metaJSON for custom attributes without additional migrations
Inventory
- Three policies per variant:
track(deduct stock),allow(always available),deny(unavailable) - Soft-reserve (
reserved_quantity) to hold stock while awaiting payment - Full reservation lifecycle via the driver:
reserve()→release()/commit() - Low-stock threshold and alerts
- Append-only movement history (audit trail for every stock change, including reservations)
MovementTypeenum:Restock,Deduction,Adjustment,Set,Reserve,ReleaseInventoryReasonconstants for consistent audit trail reason strings- Driver pattern — swap the stock system without changing application code
- Built-in:
database(stock in DB) andnull(always in stock, for digital products)
Extensibility
- Custom inventory driver — integrate your own stock system via a single interface
- No forced image schema — integrate spatie/laravel-medialibrary or any media solution you prefer
- Events:
ProductPublished,ProductArchived,InventoryAdjusted - Configurable table prefix — safe to install alongside any existing schema
Why This Package
Most ecommerce packages bundle payment, cart, and order management alongside the catalog. This package does one thing well: product catalog with variant-centric inventory. You own the order flow.
- Product is a presentation entity.
ProductVariantis the sellable unit. - Inventory is pluggable — connect your own stock system via a single interface without touching your existing code.
- No forced image schema — integrate spatie/laravel-medialibrary or your own solution.
- Configurable table prefix — safe to install alongside any existing schema.
- Slug routing that survives product renames (Shopee-style permanent route key).
Requirements
- PHP ^8.3
- Laravel ^12.0 | ^13.0
Quick Start
Installation
Publish and run the migrations:
Optionally publish the config:
Or run the interactive installer:
Configuration
Basic Usage
Products
Variants & Options
Inventory
Reservation Lifecycle
Use the inventory driver for reserve/release/commit — these methods record movements and fire events.
InventoryReason
Use InventoryReason constants to keep reason strings consistent across your application.
Add your own reason strings to config/product-catalog.php:
Taxonomy
Querying
Product Specifications
Both Product and ProductVariant have a meta JSON column for storing arbitrary key-value data — including product specifications.
Why there is no dedicated product_attributes table in this package
A filterable attribute system is a common need — but not a universal one:
| Domain | Typical attributes |
|---|---|
| Fashion | Material, Fit, Care instructions |
| Electronics | Wattage, Resolution, Storage capacity |
| Books | Genre, Language, Page count |
| Internal catalog | May not need spec filtering at all |
Because attribute schemas differ across domains, a single built-in implementation would either be too opinionated (forcing a schema that doesn't fit your domain) or too generic (adding migration weight for every consumer, even those that don't need it). The meta JSON column is the right default for specs that are display-only.
When to add filterable attributes at the application level
If your application needs to filter or search products by specification value, add a product_attributes table in your own migration:
Extend the Product model in your application:
Filter by attribute:
This keeps the package lean and gives your application full control over the attribute schema, indexing strategy, and query patterns.
Search
The default driver is database (Eloquent LIKE, no extra dependencies). Switch to scout driver for Meilisearch, Algolia, or Typesense — see docs/scout-integration.md.
When using scout, set the top-level model key to your application Product model
that extends the package base model and uses both Laravel\Scout\Searchable and
Aliziodev\ProductCatalog\Concerns\Searchable. This same key is read by the database
search driver and the API controller — configure your extended model once, everywhere.
Slug Routing
Slugs use a permanent random route_key suffix (Shopee-style). Renaming a product regenerates the slug prefix but keeps the same route key, so old URLs still resolve.
Enable the built-in read-only API routes:
API Resources
Response shape:
Events
| Event | Fired when |
|---|---|
ProductPublished |
$product->publish() |
ProductArchived |
$product->archive() |
InventoryAdjusted |
adjust(), set(), or commit() changes total quantity |
InventoryReserved |
reserve() or release() changes reserved_quantity |
Inventory Policies
Set per InventoryItem via policy column:
| Policy | Behaviour |
|---|---|
track |
Checks actual quantity; denies when quantity <= reserved_quantity |
allow |
Always in stock — overselling permitted (digital goods, pre-order) |
deny |
Always out of stock — variant is unavailable |
Spatie Media Library Integration
This package intentionally excludes a built-in image gallery to stay compatible with any media solution your application already uses.
Install spatie/laravel-medialibrary:
Extend the Product model in your application:
Important: Laravel's service container
bind()does not affect Eloquent relationships. The package's$variant->product()is hardcoded toBaseProduct::classand will still return the base model. Choose one of the two approaches below.
Approach A — Simple (recommended for most projects)
Use App\Models\Product in all your app code. When you get a product through a variant relationship and need media, re-query with your model:
Approach B — Override the relationship (complete solution)
Also extend ProductVariant to return your Product:
Then use App\Models\ProductVariant everywhere in your app code.
Upload and retrieve:
Custom Inventory Driver
If your application already has its own stock system — your own inventories table, an ERP, or a third-party WMS — you don't have to use the package's catalog_inventory_items table. Implement InventoryProviderInterface and the package will talk to your system instead.
Register the driver in a ServiceProvider:
Activate via .env:
For more examples (ERP/WMS API, fallback strategy) see docs/custom-inventory-provider.md.
Testing
When writing tests for code that uses this package, set up your test case with migrations and factories:
For tests that need the inventory facade, swap to the null driver so no DB records are required:
To override the inventory driver in a specific test:
Use-Case Docs
Detailed guides for specific scenarios:
| Guide | Description |
|---|---|
| Product Catalog | Read-only catalog with filtering, search, and slug routing |
| Online Store | Storefront with price display, stock badges, and cart-ready data |
| Simple Ecommerce | Minimal ecommerce setup with order integration |
| Internal Catalog | B2B / internal product database with cost price and meta fields |
| Digital & Physical Products | Mixed catalog with unlimited-stock and downloadable variants |
| Custom Inventory Provider | Connect ERP, WMS, Redis, or any external stock source |
| Scout Integration | Full-text search with Algolia, Meilisearch, or Typesense via Laravel Scout |
| Configuration Reference | Deep dive into every config key with pitfalls and gotchas |
License
MIT — see LICENSE.
All versions of laravel-product-catalog with dependencies
illuminate/support Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/events Version ^12.0|^13.0