Download the PHP package ozanmuyes/laravel5cart without Composer

On this page you can find all versions of the php package ozanmuyes/laravel5cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel5cart

Laravel 5 Cart

A Shopping Cart Implementation for Laravel Framework (Based on the impressive work of darryldecode)

Installation

Install the package through Composer. Edit your project's composer.json file by adding:

Next, run the Composer update command from the Terminal:

composer update

or

composer update "ozanmuyes/cart"

Configuration

  1. Open config/app.php and addd this line to your Service Providers Array

  2. Open config/app.php and addd this line to your Aliases

Table of Contents

Usage

Adding Item on Cart: Cart::add()

There are several ways you can add items on your cart, see below:

Updating an item on a cart: Cart::update()

Updating an item on a cart is very simple:

Removing an item on a cart: Cart::remove()

Removing an item on a cart is very easy:

Getting an item on a cart: Cart::get()

Getting cart's contents and count: Cart::getContent()

Check if cart is empty: Cart::isEmpty()

Get cart total quantity: Cart::getTotalQuantity()

Get cart subtotal: Cart::getSubTotal()

Get cart total: Cart::getTotal()

Clearing the Cart: Cart::clear()

Conditions

Laravel Shopping Cart supports cart conditions. Conditions are very useful in terms of (coupons,discounts,sale,per-item sale and discounts etc.) See below carefully on how to use conditions.

Conditions can be added on:

1.) Whole Cart Value bases

2.) Per-Item Bases

First let's add a condition on a Cart Bases:

There are also several ways of adding a condition on a cart: NOTE:

When adding a condition on a cart bases, the 'target' should have value of 'subtotal'. And when adding a condition on an item, the 'target' should be 'item'. The order of operation also during calculation will vary on the order you have added the conditions.

Also, when adding conditions, the 'value' field will be the bases of calculation.

NOTE: All cart based conditions should be applied before calling Cart::getTotal()

Then Finally you can call Cart::getTotal() to get the Cart Total with the applied conditions.

Next is the Condition on Per-Item Bases.

This is very useful if you have coupons to be applied specifically on an item and not on the whole cart value.

NOTE: When adding a condition on a per-item bases, the 'target' should have value of 'item'.

Now let's add condition on an item.

NOTE: All cart per-item conditions should be applied before calling Cart::getSubTotal()

Then Finally you can call Cart::getSubTotal() to get the Cart sub total with the applied conditions.

Add condition to exisiting Item on the cart: Cart::addItemCondition($productId, $itemCondition)

Adding Condition to an existing Item on the cart is simple as well.

This is very useful when adding new conditions on an item during checkout process like coupons and promo codes. Let's see the example how to do it:

Clearing Cart Conditions: Cart::clearCartConditions()

Remove Specific Cart Condition: Cart::removeCartCondition($conditionName)

Remove Specific Item Condition: Cart::removeItemCondition($itemId, $conditionName)

Get conditions by type: Cart::getConditionsByType($type)

Remove conditions by type: Cart::removeConditionsByType($type)

Instances

You may also want multiple cart instances on the same page without conflicts. To do that,

Create a new Service Provider and then on register() method, you can put this like so:

Exceptions

There are currently only two exceptions.

Exception Description
InvalidConditionException When there is an invalid field value during instantiating a new Condition
InvalidItemException When a new product has invalid field values (id,name,price,quantity)

Events

The cart has currently 9 events you can listen and hook some actons.

Event Fired
cart.created($cart) When a cart is instantiated
cart.adding($items, $cart) When an item is attempted to be added
cart.added($items, $cart) When an item is added on cart
cart.updating($items, $cart) When an item is being updated
cart.updated($items, $cart) When an item is updated
cart.removing($id, $cart) When an item is being remove
cart.removed($id, $cart) When an item is removed
cart.clearing($cart) When a cart is attempted to be cleared
cart.cleared($cart) When a cart is cleared

NOTE: If you have changed your application's namespace then correct the default namespace on published listeners.

Examples

Changelogs

**2.4.0

**2.3.0

**2.2.1

**2.2.0

**2.1.1

**2.1.0

**2.0.0 (breaking change)

**1.1.0

License

The Laravel Shopping Cart is open-sourced software licensed under the MIT license

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, OR ANY OF THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


All versions of laravel5cart with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 5.0.x|5.1.x
illuminate/validation Version 5.0.x|5.1.x
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ozanmuyes/laravel5cart contains the following files

Loading the files please wait ....