Download the PHP package mohammad-alavi/laravel-shoppingcart without Composer

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

laravel-shoppingcart

A Shopping Cart Implementation for Laravel.

Based on johannesschobel laravel-shoppingcart

Installation

Install the package through Composer.

Then, you simply add the provided migration file using the following command:

and then you migrate your database using

If you want, you can overwrite the basic configuration of this package using the following command:

This will copy the shoppingcart configuration file to your config folder. Using this file, you can customize the various parameters of the package. Currently, not many are available, however, I will be adding more and more ;)

Usage

The ShoppingCart Facade provides some neat methods to deal with the shopping cart in general. These methods are:

LOAD a ShoppingCart from the database

Load the cart with the identifier and name from the database. If no name is provided, the default name default will be used. If no cart exists, an empty cart will be returned. This cart remains temporary as long as no items are stored.

CLEAR a ShoppingCart

Removes the current instance of the cart from the database.

ADD Items to the Cart

This method allows for adding items to the cart. The basic usage allows you to directly specify the item you want to set. For example

would add 10 "Basic T-Shirts", each costs 9.99 EUR to the cart. The customer has specified a color and size.

You may, however, add the Buyable interface to your products in order to simplify this process. This will require you to implement additional methods on the model (you can add the CanBePurchased Trait in order to make a "best guess").

This would allow you to just add a specific product:

would result in the same cart as above. However, the id, name, price and uri are directly taken from the model!

REMOVE Items from the Cart

To remove an item from the shopping cart you need to have its rowId. This rowId can be obtained, for example, via the ShoppingCart::load() or ShoppingCart::getContent() method.

UPDATE Items in the Cart

allows you to update a given row in the cart. This rowId can be obtained, for example, via the ShoppingCart::load() or ShoppingCart::getContent() method.

would update the quantity and options of the item (e.g., the product to be purchased shall be 'red' instead of 'black').

Items / Price / Taxes

The Cart also provides methods to


All versions of laravel-shoppingcart with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
laravel/framework Version ^8.28.1
moneyphp/money Version ^3.3.1
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 mohammad-alavi/laravel-shoppingcart contains the following files

Loading the files please wait ....