PHPackages                             marblecms/marble-ecommerce - 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. marblecms/marble-ecommerce

ActiveMarble-plugin

marblecms/marble-ecommerce
==========================

E-commerce plugin for Marble CMS: products, orders, Stripe Checkout.

v1.0.1(1mo ago)00MITPHPPHP ^8.3

Since Apr 19Pushed 1mo agoCompare

[ Source](https://github.com/marblecms/plugin-ecommerce)[ Packagist](https://packagist.org/packages/marblecms/marble-ecommerce)[ RSS](/packages/marblecms-marble-ecommerce/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Marble E-Commerce
=================

[](#marble-e-commerce)

Full e-commerce plugin for [Marble CMS](https://github.com/marblecms/admin): products, orders, discount codes, and Stripe Checkout — all managed from the Marble admin panel.

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

[](#requirements)

- PHP 8.3+
- Marble CMS (`marble/admin`) ^1.0
- Stripe account

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

[](#installation)

```
composer require marblecms/marble-ecommerce
php artisan marble:ecommerce:install
```

Add to `.env`:

```
STRIPE_KEY=pk_live_...
STRIPE_SECRET=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
SHOP_CURRENCY=EUR
SHOP_LAYOUT=layouts.app
```

Register the Stripe webhook in your Stripe dashboard pointing to:

```
https://yourdomain.com/shop/webhook/stripe

```

---

How it works
------------

[](#how-it-works)

### Products

[](#products)

Products are standard Marble CMS Items using the `product` blueprint (auto-registered on install). Manage them in the content tree like any other item.

**Fields registered on the product blueprint:**

FieldTypeDescription`price`TextfieldDecimal price, e.g. `29.99``sku`TextfieldStock keeping unit`stock`TextfieldAvailable stock (informational)`description`HtmlblockRich text description (translatable)`images`ImagesProduct images`categories`ObjectRelationListLinked `product_category` items**Fetching products in frontend templates:**

```
// All published products
$products = Marble::items('product')->published()->get();

// Single product by slug
$product = Marble::resolve('/shop/my-product');

// Field values
$price       = $product->val('price');
$description = $product->val('description');
$images      = $product->val('images'); // array of media objects
```

### Cart

[](#cart)

The cart is session-based. You can interact with it via routes or the PHP service.

**Via Blade forms (recommended):**

```
{{-- Add to cart --}}

    @csrf

    Add to cart

{{-- Update qty --}}

    @csrf

    Update

{{-- Remove --}}

    @csrf

    Remove

```

**Via PHP (e.g. in a custom controller):**

```
use MarbleCms\ECommerce\Services\Cart;

$cart = app(Cart::class);

$cart->add($itemId, $qty);          // add qty
$cart->update($itemId, $qty);       // set exact qty (0 = remove)
$cart->remove($itemId);             // remove line
$cart->count();                     // total units in cart
$cart->lines();                     // array of cart lines (see below)
$cart->subtotalCents();             // subtotal in cents
$cart->clear();                     // empty the cart
```

Each entry in `$cart->lines()` contains:

```
[
    'item'             => Item,   // Marble Item model
    'qty'              => 2,
    'unit_price_cents' => 2999,
    'line_total_cents' => 5998,
    'label'            => 'My Product',
    'sku'              => 'ABC-123',
]
```

**Cart count in every view:**

The plugin automatically shares `$shopCartCount` with all views via a View composer. Use it in your layout:

```

    Cart
    @if($shopCartCount > 0)
        ({{ $shopCartCount }})
    @endif

```

### Mini cart Blade component

[](#mini-cart-blade-component)

Drop `` anywhere in a layout:

```
{{-- Default --}}

{{-- Custom label and CSS class --}}

```

Renders a link to the cart with the item count badge. Override the template:

```
php artisan vendor:publish --tag=shop-views
# edit resources/views/vendor/shop/components/cart.blade.php
```

### Checkout

[](#checkout)

The checkout flow is a single POST that redirects to Stripe Checkout. No card form needed on your end.

```

    @csrf

    Proceed to checkout

```

After payment Stripe redirects to:

- **Success:** `route('shop.checkout.success')`
- **Cancelled:** `route('shop.checkout.cancel')`

The Stripe webhook at `/shop/webhook/stripe` automatically marks orders as `paid` when `checkout.session.completed` fires.

### Routes

[](#routes)

MethodURINameDescriptionGET`/shop/cart``shop.cart`Cart pagePOST`/shop/cart/add``shop.cart.add`Add itemPOST`/shop/cart/update``shop.cart.update`Update qtyPOST`/shop/cart/remove``shop.cart.remove`Remove itemGET`/shop/cart/count``shop.cart.count`JSON `{"count": n}`GET`/shop/checkout``shop.checkout`Checkout summaryPOST`/shop/checkout/start``shop.checkout.start`Create Stripe session + redirectGET`/shop/checkout/success``shop.checkout.success`Post-payment success pageGET`/shop/checkout/cancel``shop.checkout.cancel`Cancelled payment pagePOST`/shop/webhook/stripe``shop.webhook.stripe`Stripe webhook (no CSRF)---

Customising views
-----------------

[](#customising-views)

Publish the frontend stub views and edit them to match your theme:

```
php artisan vendor:publish --tag=shop-views
```

This copies the following to `resources/views/vendor/shop/`:

```
shop/
  cart.blade.php
  checkout.blade.php
  success.blade.php
  cancel.blade.php
components/
  cart.blade.php

```

The `SHOP_LAYOUT` env var controls which layout these views extend (default: `layouts.app`).

---

Admin panel
-----------

[](#admin-panel)

After installing, a **Shop** menu appears in the Marble admin with:

- **Overview** — order status counters + recent orders + product list
- **Orders** — filterable order list, detail view, fulfill / cancel actions
- **Discount Codes** — create and manage codes (percent or fixed, optional expiry and usage limits)

---

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

[](#configuration)

Publish the config file to customise further:

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

`config/shop.php`:

```
return [
    'stripe_key'            => env('STRIPE_KEY'),
    'stripe_secret'         => env('STRIPE_SECRET'),
    'stripe_webhook_secret' => env('STRIPE_WEBHOOK_SECRET'),
    'currency'              => env('SHOP_CURRENCY', 'EUR'),
    'layout'                => env('SHOP_LAYOUT', 'layouts.app'),
];
```

---

Events
------

[](#events)

Listen to these Laravel events in your `EventServiceProvider` or a service provider:

```
use MarbleCms\ECommerce\Events\OrderPaid;        // fired by Stripe webhook
// (planned: OrderFulfilled, OrderCancelled)
```

For now, hook into the order status change directly via Eloquent model observers if you need custom fulfilment logic.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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 ~5 days

Total

2

Last Release

45d ago

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/marblecms-marble-ecommerce/health.svg)

```
[![Health](https://phpackages.com/badges/marblecms-marble-ecommerce/health.svg)](https://phpackages.com/packages/marblecms-marble-ecommerce)
```

PHPackages © 2026

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