PHPackages                             darkraul79/cartify - 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. [Payment Processing](/categories/payments)
4. /
5. darkraul79/cartify

ActiveLibrary[Payment Processing](/categories/payments)

darkraul79/cartify
==================

A flexible and powerful shopping cart package for Laravel applications

v0.1.1(6mo ago)0191MITPHPPHP ^8.2 || ^8.3

Since Nov 19Pushed 6mo agoCompare

[ Source](https://github.com/darkraul79/cartify)[ Packagist](https://packagist.org/packages/darkraul79/cartify)[ RSS](/packages/darkraul79-cartify/feed)WikiDiscussions main Synced 1mo ago

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

Cartify
=======

[](#cartify)

 **A flexible and powerful shopping cart package for Laravel**

 [![Latest Version](https://camo.githubusercontent.com/eca7de23ff3ff1d8de0baca04d60795eb1b9e76a9c62c4d6f3179e728a91e72c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461726b7261756c37392f63617274696679)](https://packagist.org/packages/darkraul79/cartify) [![Total Downloads](https://camo.githubusercontent.com/976a98d545adf9d91c2774d1bbb630f10fd1f15e92f8252e941a2a60baa52edc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461726b7261756c37392f63617274696679)](https://packagist.org/packages/darkraul79/cartify) [![License](https://camo.githubusercontent.com/7ffd52730f144af73b6828bef8ec154c0f8d9b8d6fff5161b34171c518c3cdca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6461726b7261756c37392f63617274696679)](https://packagist.org/packages/darkraul79/cartify)

> ⚠️ **Alpha Version (0.1.x)** - This package is in early development. APIs may change. Use with caution in production.

---

Features
--------

[](#features)

- ✅ Simple and intuitive API
- ✅ Automatic price calculations (subtotal, tax, total)
- ✅ Multiple cart instances (cart, wishlist, etc.)
- ✅ Persistent cart for authenticated users
- ✅ Session-based storage
- ✅ Database migrations included
- ✅ Flexible and extensible
- ✅ Laravel 12+ support

---

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

[](#installation)

```
composer require darkraul79/cartify
```

Publish the configuration and migrations:

```
php artisan vendor:publish --provider="Raulsdev\Cartify\CartifyServiceProvider"
```

Run migrations:

```
php artisan migrate
```

---

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

[](#configuration)

Configure in `.env`:

```
CARTIFY_TAX_RATE=0.21
CARTIFY_CURRENCY=EUR
CARTIFY_CURRENCY_SYMBOL=€
```

Or publish and edit `config/cartify.php`.

---

Quick Start
-----------

[](#quick-start)

```
use Darkraul79\Cartify\Facades\Cart;

// Add item to cart
Cart::add(
    id: 1,
    name: 'Product Name',
    quantity: 2,
    price: 29.99,
    options: ['color' => 'red', 'size' => 'M']
);

// Get cart content
$items = Cart::content();

// Calculate totals
$subtotal = Cart::subtotal();
$tax = Cart::tax(0.21); // 21% tax
$total = Cart::total(0.21);

// Update quantity
Cart::update(id: 1, quantity: 3);

// Remove item
Cart::remove(id: 1);

// Clear cart
Cart::clear();

// Count items
$count = Cart::count();
```

---

Usage
-----

[](#usage)

### Multiple Instances

[](#multiple-instances)

Use different cart instances for cart, wishlist, etc:

```
// Shopping cart
Cart::instance('cart')->add(1, 'Product A', 1, 29.99);

// Wishlist
Cart::instance('wishlist')->add(2, 'Product B', 1, 49.99);

// Get wishlist content
$wishlist = Cart::instance('wishlist')->content();
```

### User Persistence

[](#user-persistence)

Store and restore cart for authenticated users:

```
// On login
Cart::restore(); // Restore saved cart

// On logout
Cart::store(); // Save cart
```

### Merge Carts

[](#merge-carts)

Combine session cart with stored cart:

```
Cart::merge(); // Merge session cart with stored cart
```

### Search Cart

[](#search-cart)

```
$redItems = Cart::search(function ($item) {
    return $item['options']['color'] === 'red';
});
```

### Helper Functions

[](#helper-functions)

```
// Get cart instance
$cart = cart();
$wishlist = cart('wishlist');

// Format price
echo format_price(29.99); // "29,99 €"

// Generate order number
$orderNumber = generate_order_number(); // "ORD-202501-A3F9E2"
```

---

API Reference
-------------

[](#api-reference)

### Adding Items

[](#adding-items)

```
Cart::add(
    id: int|string,
    name: string,
    quantity: int = 1,
    price: float = 0,
    options: array = []
): void
```

### Updating Items

[](#updating-items)

```
Cart::update(id: int|string, quantity: int): void
```

### Removing Items

[](#removing-items)

```
Cart::remove(id: int|string): void
```

### Getting Cart Data

[](#getting-cart-data)

```
Cart::content(): Collection
Cart::get(id: int|string): ?array
Cart::has(id: int|string): bool
Cart::count(): int
Cart::isEmpty(): bool
```

### Calculations

[](#calculations)

```
Cart::subtotal(): float
Cart::tax(?float $taxRate = null): float
Cart::total(?float $taxRate = null): float
```

### Cart Management

[](#cart-management)

```
Cart::clear(): void
Cart::instance(?string $name = null): CartManager
Cart::store(?int $userId = null): void
Cart::restore(?int $userId = null): void
Cart::merge(?int $userId = null): void
```

---

Example Integration
-------------------

[](#example-integration)

### Controller

[](#controller)

```
use Raulsdev\Cartify\Facades\Cart;
use App\Models\Product;

class CartController extends Controller
{
    public function add(Request $request)
    {
        $product = Product::findOrFail($request->product_id);

        Cart::add(
            id: $product->id,
            name: $product->name,
            quantity: $request->quantity ?? 1,
            price: $product->price
        );

        return redirect()->route('cart.index');
    }

    public function index()
    {
        return view('cart.index', [
            'items' => Cart::content(),
            'total' => Cart::total(0.21),
        ]);
    }
}
```

### Blade View

[](#blade-view)

```
@foreach(Cart::content() as $item)

        {{ $item['name'] }}
        Price: {{ format_price($item['price']) }}
        Quantity: {{ $item['quantity'] }}

@endforeach

Total: {{ format_price(Cart::total(0.21)) }}
```

---

Database Schema
---------------

[](#database-schema)

The package includes a migration for persistent cart storage:

- `cart_items` table with columns:
    - `session_id` - For guest users
    - `user_id` - For authenticated users
    - `product_id` - Product reference
    - `name`, `quantity`, `price`
    - `options` - JSON field for additional data
    - `instance` - Cart instance name

---

Testing
-------

[](#testing)

```
composer test
```

---

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

---

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

---

Credits
-------

[](#credits)

- [Raul Sebastian (darkraul79)](https://github.com/darkraul79)

---

Support
-------

[](#support)

If you find this package helpful, please ⭐ star the repository!

For issues or questions, open an issue on [GitHub](https://github.com/darkraul79/cartify).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance69

Regular maintenance activity

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

180d ago

### Community

Maintainers

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

---

Top Contributors

[![darkraul79](https://avatars.githubusercontent.com/u/9088326?v=4)](https://github.com/darkraul79 "darkraul79 (2 commits)")

---

Tags

laravelorderscarte-commerceshopping cartcheckoutcartify

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/darkraul79-cartify/health.svg)

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

###  Alternatives

[amsgames/laravel-shop

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

4845.9k](/packages/amsgames-laravel-shop)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[asciisd/knet

Knet package is provides an expressive, fluent interface to KNet's payment services.

141.1k](/packages/asciisd-knet)

PHPackages © 2026

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