Download the PHP package jamesdb/cart without Composer

On this page you can find all versions of the php package jamesdb/cart. 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 cart

Shopping Cart

Build Status Coverage Status Quality Score Total Downloads

A framework agnostic shopping cart package.

Install

Via Composer

Notes

Money Value Objects

This package uses moneyphp/money (an implementation of Martin Fowler's money pattern). Floats are avoided due to them being ill-suited for monetary values. More information can be found in the links below:

Due to this when dealing with monetary values you will need to represent them as integers instead of floats.

An example of this can be found below.

Setting Up

To setup a cart instance you need to pass an identifier and storage implementation to the cart constructor.

The currency defaults to 'GBP', if you want to change this you will need to pass your currency of choice into the method as shown below.

A custom formatter callback can be setup via , see moneyphp formatters for more information.

Any storage implementation can be used as long as it implements the .

Usage

Adding Items

implements and uses the and magic methods to assign and access properties.

Added items will return a rowid.

Updating Items

You can either use the cart method or access the properties directly on the .

Attempting to update an item that doesn't exist in the cart will result in a being thrown.

Removing Items

Attempting to remove an item that doesn't exist in the cart will result in a being thrown.

Clear the Cart

Accessing a specific Item

To access a specific item use the cart method.

If an item can't be found the method will return .

Accessing all Items

Filtering Items

The cart can be filtered by any supplied key and value with the method.

Accessing Item counts

The method will return an item count excluding quantities.

The method will return an item count including quantities.

A convenience method is built into the cart, this proxies through to the getTotalUniqueItems with a === 0 check.

Accessing prices

Get the overall price including tax with the method.

Occasionally dealing with tax isn't required, in this case you can use the method.

Get the total cart tax.

Events

League\Event is built into the cart and provides a number of events that can be emitted, this allows you to easily hook into certain key points during the carts lifecycle.

You can subscribe to these events by attaching listeners to the cart via .

All events have built in methods to retrieve the item triggering the event and the cart itself.

cart.add

cart.update

cart.remove


All versions of cart with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5.0 || ^7.0
aura/session Version ^2.0
league/event Version ^2.1
moneyphp/money Version ^3.0
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 jamesdb/cart contains the following files

Loading the files please wait ....