Download the PHP package mugenzo/laravel-shopping-cart without Composer

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

LaravelShoppingCart

Installation

Run the Composer require command from the Terminal:

composer require mugenzo/laravel-shopping-cart

Now you're ready to start using the shoppingcart in your application.

Table of Contents

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

Usage

The shoppingcart gives you the following methods to use:

Cart::add()

Adding an item to the cart is really simple, you just use the add() method, which accepts a variety of parameters.

In its most basic form you can specify the id, name, quantity, price and weight of the product you'd like to add to the cart.

As an optional fifth parameter you can pass it options, so you can add multiple items with the same id, but with (for instance) a different size.

The add() method will return an CartItem instance of the item you just added to the cart.

Maybe you prefer to add the item using an array? As long as the array contains the required keys, you can pass it to the method. The options key is optional.

Cart::update()

To update an item in the cart, you'll first need the rowId of the item. Next you can use the update() method to update it.

If you simply want to update the quantity, you'll pass the update method the rowId and the new quantity:

If you would like to update options of an item inside the cart,

Cart::remove()

To remove an item for the cart, you'll again need the rowId. This rowId you simply pass to the remove() method and it will remove the item from the cart.

Cart::get()

If you want to get an item from the cart using its rowId, you can simply call the get() method on the cart and pass it the rowId.

Cart::content()

Of course you also want to get the carts content. This is where you'll use the content method. This method will return a Collection of CartItems which you can iterate over and show the content to your customers.

Cart::destroy()

Cart::total()

The total() method can be used to get the calculated total of all items in the cart, given there price and quantity.

Cart::discount()

The discount() method can be used to get the total discount of all items in the cart.

Cart::initial()

The initial() method can be used to get the total price of all items in the cart before applying discount.

Cart::count()

If you want to know how many items there are in your cart, you can use the count() method. This method will return the total number of items in the cart. So if you've added 2 books and 1 shirt, it will return 3 items.

Cart::search()

To find an item in the cart, you can use the search() method.

Cart::setDiscount($type, $value)

You can use the setDiscount() method to change the discount type and value that applies to Cart.

Configuration

If you want to change Cart options, you'll have to publish the config file.

php artisan vendor:publish --provider="Mugenzo\LaravelShoppingCart\ShoppingCartServiceProvider" --tag="config"

This will give you a shopping_cart_config.php config file in which you can make the changes.


All versions of laravel-shopping-cart with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version 5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||^6.0||^7.0
illuminate/session Version 5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||^6.0||^7.0
illuminate/events Version 5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||^6.0||^7.0
nesbot/carbon Version ~1.20||^1.26.3||^2.0
ext-json Version *
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 mugenzo/laravel-shopping-cart contains the following files

Loading the files please wait ....