PHPackages                             escolasoft/cart - 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. escolasoft/cart

ActivePackage

escolasoft/cart
===============

Escola Headless LMS Cart

0.4.81(8mo ago)25MITPHPPHP &gt;=7.4CI failing

Since Jun 23Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/EscolaLMS/Cart)[ Packagist](https://packagist.org/packages/escolasoft/cart)[ RSS](/packages/escolasoft-cart/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (16)Versions (136)Used By (0)

Cart
====

[](#cart)

[![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/Cart/)[![codecov](https://camo.githubusercontent.com/574654393dc74a167c19b138c066e74ffb93f628ffd9a0df0dde09a162c0e1b9/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f636172742f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e52414e34523841475a)](https://codecov.io/gh/EscolaLMS/cart)[![phpunit](https://github.com/EscolaLMS/cart/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/cart/actions/workflows/test.yml)[![downloads](https://camo.githubusercontent.com/b61afaa3db3b698b2c0f02cfd9407acbdfa58a3453c52b976fb3fc4152859214/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6573636f6c616c6d732f63617274)](https://packagist.org/packages/escolalms/cart)[![downloads](https://camo.githubusercontent.com/93975212459036f3373846848aa67c92112b16dab42199010e04b5a8da3035bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6573636f6c616c6d732f63617274)](https://packagist.org/packages/escolalms/cart)[![downloads](https://camo.githubusercontent.com/916c2a12e6f5a96a13875be51431c01f3c4f67f0c75e1e3465691682716a0848/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6573636f6c616c6d732f63617274)](https://packagist.org/packages/escolalms/cart)[![Maintainability](https://camo.githubusercontent.com/6a546f3eacf51cf35c32f991357994450fb291452eb6cac907a42b62b8f6326a/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f62386338616131363937363936316636373062342f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/EscolaLMS/Cart/maintainability)[![Mutation testing badge](https://camo.githubusercontent.com/985cf015080dc38d2daec50d825b13100f3bc4946f9799696cc395d26bd43ac4/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532464573636f6c614c4d53253246436172742532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/EscolaLMS/Cart/main)

Purpose
-------

[](#purpose)

This package lets you manage user Shopping Cart, and defines what is a buyable Product (and what are Productables, that is sellable things), that can be then added to the Cart. This package also lets your users create Orders and buy content of their Carts.

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

[](#installation)

- `composer require escolalms/cart`
- `php artisan migrate`
- `php artisan db:seed --class="EscolaLms\Cart\Database\Seeders\CartPermissionSeeder"`

Dependencies
------------

[](#dependencies)

This package depends on [EscolaLms/Payments](https://github.com/EscolaLMS/Payments) package for creating and processing Payments for Orders.

Usage
-----

[](#usage)

### Product

[](#product)

`EscolaLms\Cart\Models\Product` is a Model that represents abstract buyable thing that can be added to Cart and bought. Product by itself has no additional functionality than being bought and assigned to Users.

Products consist of one (Single type products) or more (Bundle type products) Productables - that is, Models representing concrete things that are sold in your (LMS) application, for example Courses. Productables must implement Productable interface.

### Productable

[](#productable)

`EscolaLms\Cart\Contracts\Productable` interface defines how Model representing sellable things behave and which methods and relations they must contain.

### Defining Productables

[](#defining-productables)

To create (and sell) Products, you need to define Productables. A Productable is a Model implementing `EscolaLms\Cart\Models\Contracts` interface (and possibly using `EscolaLms\Cart\Contracts\ProductableTrait`). After adding this interface to your Model, you need to call `EscolaLms\Cart\Facades\Shop::registerProductableClass(Productable::class)` in one of your Service Providers boot method. This will enable using this Productable Model as a (part of) Product which can then be sold.

### Shop Facade

[](#shop-facade)

Shop Facade wraps `EscolaLms\Cart\Services\ProductService` giving access to methods related to registering Productables and managing Products.

### Cart Model

[](#cart-model)

`EscolaLms\Cart\Models\Cart` is a model representing User Cart. Every User can have one active (existing) Cart at given time.

To create Cart (or retrieve current active Cart) for a given user, you need to call `EscolaLms\Cart\Services\ShopService::cartForUser($user)` method.

### Cart Manager

[](#cart-manager)

Cart and its content is managed using `EscolaLms\Cart\Services\CartManager` class instance attached to that Cart, instead of manipulating Cart object directly. `CartManager` is used by `EscolaLms\Cart\Services\ShopService` (and you probably don't need to use it directly, as methods in ShopService represent all sensible use cases).

### Shop Service

[](#shop-service)

Shop Service contains functionality related to managing Cart content (adding/removing Products), and purchasing Cart (storing Cart data as an Order and processing payment flow).

Endpoints
---------

[](#endpoints)

All the endpoints are defined in [![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/cart/).

Tests
-----

[](#tests)

Run `./vendor/bin/phpunit` to run tests. See [tests](tests) directory as it's a quite good starting point for understanding how this package works. Especially pay attention to [tests/Mocks](tests/Mocks) directory, as it represents core concepts of Productable and use of Productable Trait &amp; Interface.

Test details [![codecov](https://camo.githubusercontent.com/574654393dc74a167c19b138c066e74ffb93f628ffd9a0df0dde09a162c0e1b9/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f636172742f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e52414e34523841475a)](https://codecov.io/gh/EscolaLMS/cart) [![phpunit](https://github.com/EscolaLMS/cart/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/cart/actions/workflows/test.yml)

Events
------

[](#events)

- `EscolaLms\Cart\Events\AbandonedCartEvent` - emited when scheduled job finds a non-empty Cart older than 24 hours
- `EscolaLms\Cart\Events\OrderCancelled` - emited after payment processing is cancelled, which marks Order as cancelled
- `EscolaLms\Cart\Events\OrderCreated` - emited when new Order is created
- `EscolaLms\Cart\Events\OrderPaid` - emited after order was paid
- `EscolaLms\Cart\Events\ProductableAttached` - emited after Productable is attached to an User (for example after Product containing that Productable is attached to User, or admin endpoints for managing Productable attachments is used)
- `EscolaLms\Cart\Events\ProductableDetached` - analogous to ProductableAttached
- `EscolaLms\Cart\Events\ProductAddedToCart` - emitted when Product is added to Cart
- `EscolaLms\Cart\Events\ProductAttached` - emitted when Product is attached to User (after buying it or adding it using admin endpoint)
- `EscolaLms\Cart\Events\ProductBought` - emited after Product is bought by User
- `EscolaLms\Cart\Events\ProductDetached` - analogous to ProductAttached
- `EscolaLms\Cart\Events\ProductRemovedFromCart` - analogous to ProductAdded

Listeners
---------

[](#listeners)

- `EscolaLms\Cart\Listeners\PaymentSuccessListener` - this listener handles marking Orders as Paid after a Payment created for given Order is marked as Paid (listens to `EscolaLms\Payments\Events\PaymentSuccess` event)

How to use this on frontend
---------------------------

[](#how-to-use-this-on-frontend)

### Admin panel

[](#admin-panel)

#### **Left menu**

[](#left-menu)

[![Admin panel menu](docs/menu.png "Admin panel menu")](docs/menu.png)

#### **List of Products**

[](#list-of-products)

[![List of Products](docs/products-list.png "List of Products")](docs/products-list.png)

#### **Creating/editing Product**

[](#creatingediting-product)

[![Creating/editing Product](docs/products-edit.png "Creating/editing Product")](docs/products-edit.png)

#### **List of Orders**

[](#list-of-orders)

[![List of Orders](docs/orders-list.png "List of Orders")](docs/orders-list.png)

#### **Details of Order**

[](#details-of-order)

[![Details of Order](docs/orders-details.png "Details of Order")](docs/orders-details.png)

Permissions
-----------

[](#permissions)

Permissions are defined in [Enum](src/Enums/CartPermissionsEnum.php) and seeded in [Seeder](database/seeders/CartPermissionSeeder.php).

Roadmap. Todo. Troubleshooting
------------------------------

[](#roadmap-todo-troubleshooting)

- ???

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance62

Regular maintenance activity

Popularity7

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~136 days

Total

132

Last Release

241d ago

PHP version history (2 changes)0.0.1PHP ^7.4|^8.0

0.4.71PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![pa-cholek](https://avatars.githubusercontent.com/u/5345420?v=4)](https://github.com/pa-cholek "pa-cholek (118 commits)")[![qunabu](https://avatars.githubusercontent.com/u/214608?v=4)](https://github.com/qunabu "qunabu (39 commits)")[![HerbertIV](https://avatars.githubusercontent.com/u/62691459?v=4)](https://github.com/HerbertIV "HerbertIV (37 commits)")[![mako321](https://avatars.githubusercontent.com/u/59456825?v=4)](https://github.com/mako321 "mako321 (22 commits)")[![daVitekPL](https://avatars.githubusercontent.com/u/58150098?v=4)](https://github.com/daVitekPL "daVitekPL (19 commits)")[![dyfero](https://avatars.githubusercontent.com/u/59400506?v=4)](https://github.com/dyfero "dyfero (15 commits)")[![dicani0](https://avatars.githubusercontent.com/u/58490533?v=4)](https://github.com/dicani0 "dicani0 (7 commits)")[![KrzysztofDziedziechEscolasoft](https://avatars.githubusercontent.com/u/96292232?v=4)](https://github.com/KrzysztofDziedziechEscolasoft "KrzysztofDziedziechEscolasoft (5 commits)")[![krzEscola](https://avatars.githubusercontent.com/u/85549830?v=4)](https://github.com/krzEscola "krzEscola (2 commits)")[![victazzz](https://avatars.githubusercontent.com/u/24989821?v=4)](https://github.com/victazzz "victazzz (1 commits)")[![ArtKob](https://avatars.githubusercontent.com/u/108077902?v=4)](https://github.com/ArtKob "ArtKob (1 commits)")

---

Tags

e-commerceheadlesslaravellms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/escolasoft-cart/health.svg)

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

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

22.0k32.8k1](/packages/krayin-laravel-crm)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[ronasit/laravel-helpers

Provided helpers function and some helper class.

1475.7k13](/packages/ronasit-laravel-helpers)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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