Download the PHP package ashraam/laravel-simple-cart without Composer

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

Laravel Simple Cart

Test Latest Version on Packagist Total Downloads

Laravel Simple Cart is a lightweight, session-based shopping cart implementation designed specifically for Laravel 10/11/12 applications. It provides a simple yet comprehensive solution for adding e-commerce cart functionality without requiring database storage.

Features

Installation

You can install the package via composer:

Service Provider Auto-Discovery

This package supports Laravel's auto-discovery feature. The service provider and facade will be automatically registered.

Publishing Configuration

You can publish the configuration file with:

This will create a config/laravel-simple-cart.php file in your application.

Usage

The package provides a simple API to manage your shopping cart:

Item Management

Adding vs Replacing Items

Understanding the difference between add() and replace() methods:

Common Use Cases for replace()

Updating item properties with same ID+options:

Switching between variants (different hashes):

Modifiers

Modifiers can be applied to the cart by using this API:

Events

The package dispatches several events to allow you to hook into the cart's lifecycle. All events contain the cart instance name.

Event Description
Ashraam\LaravelSimpleCart\Events\ItemAdded($instance, $item) Dispatched when an item is added to the cart.
Ashraam\LaravelSimpleCart\Events\ItemReplaced($instance, $item) Dispatched when an existing item is replaced.
Ashraam\LaravelSimpleCart\Events\ItemQuantityUpdated($instance, $item) Dispatched when an item's quantity is updated.
Ashraam\LaravelSimpleCart\Events\ItemRemoved($instance) Dispatched when an item is removed from the cart.
Ashraam\LaravelSimpleCart\Events\CartCleared($instance) Dispatched when the cart is cleared.

Classes and methods

Cart

You may have multiple instances of the cart by using the instance() method of the cart.

You can apply modifiers to the cart using this api:

Cart Item

An item has a unique hash that serves as ID. This hash is composed of the item id and options. If you update the id or the options, the hash will be regenerated, so it's recommended to remove the item from the cart first, update the item, and then add it back.

CartItem available methods

Configuration

After publishing the configuration file, you'll find it at config/laravel-simple-cart.php:

Configuration Options

Session Management

The cart uses Laravel's session system to store cart data. Here's what you need to know:

Session Storage Structure

Session Persistence

Session Access

Performance Considerations

Session Storage Limitations

Best Practices

When to Use Multiple Cart Instances

API Reference

Complete Method Signatures

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of laravel-simple-cart with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/session Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/events Version ^10.0|^11.0|^12.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 ashraam/laravel-simple-cart contains the following files

Loading the files please wait ....