PHPackages                             marshmallow/products - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. marshmallow/products

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

marshmallow/products
====================

Package that will contain basic methods for handeling products and preparing them toe be used in ecommerce.

5.1.0(10mo ago)17.4k11MITPHPPHP ^8.1CI failing

Since Apr 3Pushed 2w ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/products)[ Packagist](https://packagist.org/packages/marshmallow/products)[ Docs](https://github.com/Marshmallow-Development/)[ RSS](/packages/marshmallow-products/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (7)Versions (27)Used By (1)

[![alt text](https://camo.githubusercontent.com/329958cb02b7bee461fd9dcae7a0a3a34e6595669116ff441ad5ef9e77bc511c/68747470733a2f2f63646e2e6d617273686d616c6c6f772d6f66666963652e636f6d2f6d656469612f696d616765732f6c6f676f2f6d617273686d616c6c6f772e7472616e73706172656e742e7265642e706e67 "marshmallow.")](https://camo.githubusercontent.com/329958cb02b7bee461fd9dcae7a0a3a34e6595669116ff441ad5ef9e77bc511c/68747470733a2f2f63646e2e6d617273686d616c6c6f772d6f66666963652e636f6d2f6d656469612f696d616765732f6c6f676f2f6d617273686d616c6c6f772e7472616e73706172656e742e7265642e706e67)

Marshmallow Products
====================

[](#marshmallow-products)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1ad4a42bc3b178d1af6e2b4314754b760bd94ae513cc220bbcf937f8f9992ad2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f70726f64756374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/products)[![Total Downloads](https://camo.githubusercontent.com/2cb51553466387ddb93ef43e5e51d175e27601c9f5ad29ed394b4b5cc45b6b1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f70726f64756374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/products)

Basic building blocks for handling products and preparing them to be used in e-commerce. This package ships the `Product`, `ProductCategory` and `Supplier` models (with prices, SEO, slugs, soft deletes and flexible images) plus matching Laravel Nova resources. It is typically used together with Marshmallow's Cart or Ecommerce packages.

Requirements
------------

[](#requirements)

- PHP `^8.1`
- [Laravel Nova](https://nova.laravel.com) `^5.0`

Laravel Nova is a paid product. Make sure your Composer is authenticated against `https://nova.laravel.com` before installing.

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

[](#installation)

Install the package via Composer:

```
composer require marshmallow/products
```

The service provider is auto-discovered. It registers the package config and loads the package migrations automatically, so a `php artisan migrate` is all that is needed to create the `products`, `product_categories`, `suppliers` and pivot tables.

Register the product observer in your application's `AppServiceProvider::boot()` method:

```
use Marshmallow\Product\Models\Product;
use Marshmallow\Product\Observers\ProductObserver;

public function boot()
{
    Product::observe(ProductObserver::class);
}
```

Seed the default VAT rates (provided by `marshmallow/priceable`) so products can be priced:

```
php artisan db:seed --class="Marshmallow\Priceable\Database\Seeds\VatRatesSeeder"
```

### Publishing the config

[](#publishing-the-config)

Optionally publish the config file to override the models, Nova resources and defaults:

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

After installation
------------------

[](#after-installation)

Generate the Nova resources for this package (and for the Priceable resources it relies on) using the `marshmallow:resource` command from `marshmallow/commands`:

```
php artisan marshmallow:resource Product Product
php artisan marshmallow:resource Supplier Product
php artisan marshmallow:resource ProductCategory Product
php artisan marshmallow:resource Price Priceable
php artisan marshmallow:resource VatRate Priceable
php artisan marshmallow:resource Currency Priceable
```

Set your default currency in your `.env`:

```
CURRENCY=eur
```

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

[](#configuration)

The published `config/product.php` file exposes the following options:

KeyDefaultDescription`models.product``Marshmallow\Product\Models\Product`The Product Eloquent model. Override to use your own.`models.product_category``Marshmallow\Product\Models\ProductCategory`The ProductCategory Eloquent model.`models.supplier``Marshmallow\Product\Models\Supplier`The Supplier Eloquent model.`nova.wysiwyg``Laravel\Nova\Fields\Trix` (env `NOVA_WYSIWYG`)The Nova field used for the product body.`nova.prices_are_including_vat``true`Whether prices entered in Nova already include VAT.`nova.defaults.currencies``1`Default currency id used on new prices.`nova.defaults.vat_rates``3`Default VAT rate id used on new prices.`nova.resources``Marshmallow\Product\Nova\*`The Nova resource classes for product, category and supplier (price resource comes from Priceable).`nova.relationships.product_supplier``Marshmallow\Product\Nova\Relationships\ProductSupplier::class`The pivot definition for the product/supplier relationship.`default_product_view``shop.product`The blade view used to render a product detail page.`channels``[]`Optional sales channels (e.g. Bol.com) to expose the product on.Usage
-----

[](#usage)

### The Product model

[](#the-product-model)

```
use Marshmallow\Product\Models\Product;

$product = Product::factory()->create([
    'name' => 'Example product',
]);

// Eager load the common relationships to prevent N+1 queries.
$products = Product::active()->withRelationships()->get();

foreach ($products as $product) {
    $product->fullname();        // human readable name
    $product->freeStock();       // amount purchasable right now
    $product->getAvailability(); // Product::IN_STOCK | OUT_OF_STOCK | PREORDER
    $product->getCondition();    // 'new'
    $product->route();           // route('product.detail', $product)

    if ($product->hasImage()) {
        $product->firstImagePath();
    }
}
```

A `Product` is sluggable, SEO-able and priceable, uses soft deletes, and casts its `images` attribute to a Nova Flexible value. It exposes `category()` (belongs-to), `categories()` and `suppliers()` (belongs-to-many) relationships, all resolved through the configurable model classes.

### Available scopes

[](#available-scopes)

ScopeDescription`active()`Only products where `active = 1`.`withRelationships()`Eager loads `category`, `categories`, `suppliers` and `media`.### Stock status constants

[](#stock-status-constants)

```
Product::IN_STOCK;
Product::OUT_OF_STOCK;
Product::PREORDER;
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please report security vulnerabilities by email to  rather than via the public issue tracker.

Credits
-------

[](#credits)

- [Stef](https://marshmallow.dev)
- [All Contributors](https://github.com/marshmallow-packages/products/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](LICENSE) for more information.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 89.7% 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.

###  Release Activity

Cadence

Every ~81 days

Recently: every ~93 days

Total

25

Last Release

324d ago

Major Versions

v1.2.6 → v2.0.02022-03-03

v2.1.0 → v3.0.02022-05-10

v3.1.0 → 5.0.02025-02-27

PHP version history (5 changes)v1.0.0PHP ^7.4

v1.2.4PHP ^7.4|^8.0

v2.0.0PHP ^7.4|^8.0|^8.1

v3.0.0PHP ^8.0|^8.1

5.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/be33d2624e24c516e73892b0929447cc762f3622c024ab8d0d2a59042e5d2c7f?d=identicon)[marshmallow](/maintainers/marshmallow)

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (87 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![milan607](https://avatars.githubusercontent.com/u/258212842?v=4)](https://github.com/milan607 "milan607 (1 commits)")

---

Tags

marshmallow

### Embed Badge

![Health badge](/badges/marshmallow-products/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-products/health.svg)](https://phpackages.com/packages/marshmallow-products)
```

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

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