PHPackages                             marshmallow/priceable - 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/priceable

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

marshmallow/priceable
=====================

Package for handeling prices

v3.2.3(1mo ago)17.9k2MITPHPPHP ^8.0|^8.1CI passing

Since Apr 3Pushed 1mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (10)Versions (37)Used By (2)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Laravel Priceable
=================

[](#laravel-priceable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/90a5e6b99d54546d18e5cde93b935e2275507ac401eb3d702d370c4c73f63c63/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f707269636561626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/priceable)[![Total Downloads](https://camo.githubusercontent.com/da6a25e837f3e423dd21e96b0ee8ba6e4c88ffc3c8604394da341c33036298a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f707269636561626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/priceable)

Attach prices, currencies, VAT rates and price types to any Eloquent model. Priceable handles VAT calculation, multi-currency, discounts and validity periods, and ships ready-made Laravel Nova resources for managing it all.

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

[](#installation)

Priceable depends on [Laravel Nova](https://nova.laravel.com), a paid package. Make sure the Nova Composer repository is configured and your credentials are set:

```
composer config repositories.nova composer https://nova.laravel.com
composer config http-basic.nova.laravel.com "your-email" "your-license-key"
```

Install the package via Composer:

```
composer require marshmallow/priceable
```

Publish the config file:

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

The migrations are loaded automatically by the package, so just run:

```
php artisan migrate
```

Seed the default currencies and VAT rates:

```
php artisan db:seed --class="Marshmallow\Priceable\Seeders\CurrencySeeder"
php artisan db:seed --class="Marshmallow\Priceable\Seeders\VatRatesSeeder"
```

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

[](#configuration)

`config/priceable.php`:

KeyDefaultDescription`detault_price_type``1`The price type id used when a model doesn't ask for a specific one.`currency``env('CURRENCY', 'eur')`Default currency code.`currency_locale``env('CURRENCY_LOCALE', 'nl')`Locale used to format money.`models``Price`, `Currency`, `VatRate`, `PriceType`Swap any model for your own implementation.`resources`Priceable Nova resourcesSwap any Nova resource for your own.`nova.prices_are_including_vat``true`Whether prices entered in Nova include VAT.`nova.defaults.currencies``1`Default currency id for new prices.`nova.defaults.vat_rates``2`Default VAT rate id for new prices.`nova.resources``[]`Priceable models that Nova should expose.`on_multiple_prices``'lowest'`Which price wins when a model has several: `highest`, `lowest`, `eldest`, `newest`.`public_excluding_vat``false`Display prices excluding VAT on the front-end.`observers.price``PriceableObserver`Observer that computes the VAT columns on save.Usage
-----

[](#usage)

Add the `Priceable` trait to any model you want to price:

```
use Illuminate\Database\Eloquent\Model;
use Marshmallow\Priceable\Traits\Priceable;

class Product extends Model
{
    use Priceable;
}
```

Attach a price (prices are polymorphic, so any priceable model works):

```
$product->prices()->create([
    'price_type_id' => config('priceable.detault_price_type'),
    'currency_id'   => 1,
    'vatrate_id'    => 2,
    'display_price' => 19.95,
    'valid_from'    => now(),
]);
```

Read prices on the front-end:

```
$product->currentPrice();   // numeric price for the active currency & price type
$product->price;            // the resolved Price model (->price(), ->formatPrice(), ...)
$product->price_formatted;  // formatted string, e.g. "€ 19,95"

$product->isDiscounted();   // true when multiple prices resolve to different amounts
$product->discountedFrom(); // the highest price, to show a struck-through "from" price
```

Ask for a specific price type:

```
use Marshmallow\Priceable\Models\PriceType;

$product->priceType(PriceType::find(2))->currentPrice();
```

### Switching currency

[](#switching-currency)

The package registers a named `set-currency` route and request macros:

```
@foreach (\Marshmallow\Priceable\Models\Currency::get() as $currency)
    {{ $currency->name }}
@endforeach
```

```
request()->getUserCurrency();           // the visitor's active currency
request()->setUserCurrency($currency);  // set it manually
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For larger changes, please open an issue first to discuss what you would like to change.

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Stef van Esch](https://github.com/stefvanesch)
- [All Contributors](https://github.com/marshmallow-packages/priceable/contributors)

License
-------

[](#license)

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

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance88

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 96% 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 ~70 days

Recently: every ~173 days

Total

33

Last Release

58d ago

Major Versions

v1.6.0 → v2.0.02021-12-24

v2.2.0 → v3.0.02022-05-10

PHP version history (4 changes)v1.0.1PHP ^7.4

v1.4.2PHP ^7.4|^8.0

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

v3.0.0PHP ^8.0|^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 (97 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (4 commits)")

---

Tags

marshmallow

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.3k](/packages/craftcms-cms)[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k76](/packages/verbb-formie)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2852.2M9](/packages/outl1ne-nova-sortable)[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2852.2M6](/packages/optimistdigital-nova-sortable)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17930.8k](/packages/markwalet-nova-modal-response)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3618.3k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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