selli/commerce 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

selli/commerce

Composer 安装命令:

composer require selli/commerce

包简介

A headless, catalog-agnostic commerce domain engine for Laravel: cart, order lifecycle, deterministic pricing pipeline, tax and inventory — multi-tenant, multi-currency, audited and ACL-protected.

README 文档

README

Laravel Commerce — agnostic carts & orders

Laravel Commerce

Tests PHPStan License: MIT

A headless, catalog-agnostic commerce domain engine for Laravel: cart, order lifecycle, a deterministic pricing pipeline, multi-tenancy, multi-currency, an immutable audit trail and ACL — the transactional heart you build stores, checkouts, booking systems and quote flows on top of.

It is not a turnkey store. It owns the parts of commerce that are hard to get right and identical across projects — money, order states, the calculation pipeline — and nothing else. Your catalogue stays yours: anything implementing the Purchasable contract becomes sellable.

📚 Full documentation: https://laravel-commerce.selli.io

Why

Every commercial app re-writes cart, totals, discounts, VAT and order states — and re-introduces the same bugs (rounding, inclusive/exclusive tax, stock race conditions) project after project. Laravel Commerce is one engine, tested to the bone, reused across N projects.

Highlights

  • Catalog-agnostic — binds to your models via the Purchasable contract; freezes an immutable order snapshot so history never changes when your catalogue does.
  • Headless & unopinionated — no routes, controllers or templates imposed. Pure service layer + events.
  • Money correct by constructionbrick/money in minor units, never a float; centralised, per-currency rounding.
  • Deterministic calculation pipeline — an explainable, line-by-line breakdown; reorderable and extensible without touching the core.
  • Order state machinespatie/laravel-model-states; illegal transitions are impossible by construction, authorised by policy and logged append-only.
  • Multi-tenant & multi-currencytenant_id + global scope on every table; one engine serves single-tenant and SaaS alike.
  • Audited — every domain event persisted append-only; optional event sourcing for the Order aggregate.
  • Optional modules — toggle each independently: Pricing (price books, coupons, promotions, gift cards), Tax (per-line jurisdictions, inclusive/exclusive, EU exemption & reverse charge) and Inventory (per-warehouse stock, TTL reservations, oversell prevention under a lock).

Requirements

  • PHP 8.3+ (8.3 / 8.4 / 8.5)
  • Laravel 12 or 13

Installation

composer require selli/commerce
php artisan vendor:publish --tag="commerce-migrations"
php artisan migrate

Quick start

use Selli\Commerce\Cart\CartManager;
use Selli\Commerce\Order\Actions\PlaceOrder;
use Selli\Commerce\Order\Actions\TransitionOrderState;
use Selli\Commerce\Order\States\Confirmed;

$carts = app(CartManager::class);

$cart = $carts->forOwner('user', (string) $user->id, 'EUR');
$carts->add($cart, $product, quantity: 2, options: ['size' => 'L']);

$calculation = $carts->calculate($cart);   // deterministic, explainable
$calculation->grandTotal();                 // Brick\Money\Money
$calculation->breakdown();                  // subtotal, discounts, tax, lines

$order = app(PlaceOrder::class)->handle($cart);   // transactional, emits OrderPlaced
$order->state;                                     // Pending

app(TransitionOrderState::class)->handle($order, Confirmed::class, by: $agent, reason: 'payment ok');

See the Quick Start guide for the full walkthrough, including implementing Purchasable on your model.

Documentation

The documentation site is built with docmd:

npm install
npm run docs:build   # outputs to ./site
npm run docs:dev     # local preview

Testing

composer test            # Pest suite
composer test-coverage   # with 90% minimum coverage gate
composer analyse         # PHPStan (max level)
composer format          # Pint

Roadmap

The core (cart, order, calculation pipeline, multi-tenancy, multi-currency, audit, ACL) and the Pricing & Promotions, Tax and Inventory modules have shipped. Next on the roadmap: Payments orchestration, Fulfillment and optional REST/GraphQL/Filament surfaces.

License

The MIT License (MIT). See License File.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固