New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

aharen/cart

Simple Session based cart for shopping websites
58
Install
composer require aharen/cart
Latest Version:v1.0
PHP:>=5.4.0
License:MIT
Last Updated:Aug 13, 2016
Links: GitHub  ·  Packagist
Maintainer: aharen

Cart

Simple Session based cart for shopping websites in Laravel

Installation

composer require aharen/cart

Configuration

  1. Add CartServiceProvider to providers in config/app.php

    aharen\Cart\CartServiceProvider::class,

  2. Add Cart Facade to aliases in config/app.php

    'Cart' => aharen\Cart\CartFacade::class,

  3. Publish the config file to config folder

    php artisan vendor:publish

If so some reason it doesn't create the config file you have to create a file named cart.php inside the config folder with the contents below

<?php
return [
	'name' => 'yourcartnamehere',
];

Usage

Get items currently in cart

Get the current contents of the cart. Will return false if the cart is empty

Cart::get();

Count items currently in cart

Cart::count();

Add item to cart

The first parameter is your item. It can either be an ID or item name. The second parameter has to be numeric which is the Quantity.

Cart::add('Pizza Slice', 2);

Remove Item from cart

Accepts only 1 parameter, which is your item ID or item name

Cart::remove('Pizza Slice');

Reset the cart

Empties your current cart

Cart::reset();

Related Packages

firework/cart

Work with shopping carts with a dead simple API, Firework Cart is also very exte...

7 3
lukepolo/laracart

A simple cart for Laravel

191,682 583
jackiedo/cart

A package used to create and manage carts (such as shopping, recently viewed, co...

55,933 210
yabhq/laravel-cart

Simple yet customizable Laravel shopping cart

3,068 20
php-soft/laravel-shopping-cart

Laravel Shopping Cart Module

231 7

Version History

Version Released PHP License
v1.0 >=5.4.0 MIT