Download the PHP package jackiedo/shoppingcart without Composer

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

Laravel Shopping Cart

A small package use to create shopping cart in Laravel application. (Now just only support Laravel 4.x)

Announcement of abandonment

This package is abandoned. Please use the Laravel-Cart package of same distributor for replacement.

Overview

Look at one of the following topics to learn more about LaravelShoppingCart

Installation

You can install this package through Composer.

And the final step is add the follow line to the section aliases:

Usage

Add item to cart

Add a new item.

example:

Update item

Update the specified item.

example:

Get all items

Get all the items.

example:

Get item

Get the specified item.

example:

Remove item

Remove the specified item by raw ID.

example:

Destroy cart

Clean Shopping Cart.

example:

Get total price

Returns the total price of all items.

example:

Count rows

Return the number of rows.

example:

Count quantity

Returns the quantity of all items

$totalItems : When false,will return the number of rows.

example:

Search items

Search items by property.

example:

Collections

As you might have seen, there are two methods and one property both return a Collection. These are the Cart::content() (Cart), Cart::get() (CartItem) and Cart::get()->options (CartItemOptions).

These Collections extends the 'native' Laravel Collection class, so all methods you know from Collection class can also be used on your shopping cart. With some addition to easily work with your carts content.

Instances

Now the packages also supports multiple instances of the cart. The way this works is like this:

You can set the current instance of the cart with Cart::instance('newInstance'), at that moment, the active instance of the cart is newInstance, so when you add, remove or get the content of the cart, you work with the newInstance instance of the cart.

If you want to switch instances, you just call Cart::instance('otherInstance') again, and you're working with the otherInstance again.

So a little example:

Note:

Models

A special feature is associating a model with the items in the cart. Let's say you have a Product model in your application. With the new associate() method, you can tell the cart that an item in the cart, is associated to the Product model. That way you can access your model right from the CartItem!

example:

The keyword to access the model is the snake case of model name you associated (Ex: Model name is ShoppingProduct, then the keyword is shopping_product). The associate() method has a second optional parameter for specifying the model namespace.

Exceptions

The Cart package will throw exceptions if something goes wrong. This way it's easier to debug your code using the Cart package or to handle the error based on the type of exceptions. The Cart packages can throw the following exceptions:

Exception Reason
ShoppingcartInvalidItemException When a new product misses id or title argument (id, title)
ShoppingcartInvalidPriceException When a non-numeric or negative price is passed
ShoppingcartInvalidQtyException When a non-numeric or less than 1 quantity is passed
ShoppingcartInvalidRawIDException When the $rawId that got passed doesn't exists in the current cart
ShoppingcartUnknownModelException When an unknown model is associated to a cart row

Events

Event Name Parameters
cart.adding ($attributes, $cart);
cart.added ($attributes, $cart);
cart.updating ($row, $cart);
cart.updated ($row, $cart);
cart.removing ($row, $cart);
cart.removed ($row, $cart);
cart.destroying ($cart);
cart.destroyed ($cart);

You can easily handle these events, for example:

License

MIT

Thanks for use

Hopefully, this package is useful to you.


All versions of shoppingcart with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.2.*
illuminate/session Version 4.2.*
illuminate/events Version 4.2.*
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 jackiedo/shoppingcart contains the following files

Loading the files please wait ....