PHPackages                             hridoyraisul/cartwishlistlaravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. hridoyraisul/cartwishlistlaravel

ActiveLibrary

hridoyraisul/cartwishlistlaravel
================================

This package provide basic "add to cart" and "add to wishlist" functionalities for building e-commerce project with Laravel framework

v1.0.1(3y ago)056MITPHP

Since Feb 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hridoyraisul/Cart-Wishlist-Laravel-Package)[ Packagist](https://packagist.org/packages/hridoyraisul/cartwishlistlaravel)[ RSS](/packages/hridoyraisul-cartwishlistlaravel/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Cart &amp; Wishlist Package for Laravel App
===========================================

[](#cart--wishlist-package-for-laravel-app)

This package provides basic "add to cart" and "add to wishlist" functionalities for building e-commerce project with Laravel framework

---

Installations
-------------

[](#installations)

#### Step-1: Run Command Below

[](#step-1-run-command-below)

```
composer require hridoyraisul/cartwishlistlaravel

```

#### Step-2: Add the line below to providers array in config/app.php file

[](#step-2-add-the-line-below-to-providers-array-in-configappphp-file)

```
RaisulHridoy\CartWishList\CartWishlistServiceProvider::class,

```

#### Step-3: Optimize Laravel App

[](#step-3-optimize-laravel-app)

```
php artisan optimize

```

#### Step-4: Run Migration Command:

[](#step-4-run-migration-command)

```
php artisan migrate

```

Done !!! Let's have some fun now 😉

---

Usage
-----

[](#usage)

#### Firstly, add the line below to your controller

[](#firstly-add-the-line-below-to-your-controller)

```
use RaisulHridoy\CartWishList\Http\Interfaces\CartWishlistInterface;

```

#### Secondly, declare interface in controller through constructor function

[](#secondly-declare-interface-in-controller-through-constructor-function)

```
protected $cartWishlist;
public function __construct(CartWishlistInterface $cartWishlistInterface)
{
    $this->cartWishlist = $cartWishlistInterface;
}

```

#### Trirdly, call interfaces predefined method in controller with require parameter

[](#trirdly-call-interfaces-predefined-method-in-controller-with-require-parameter)

```
public function example()
{
    $user_id = 1; //as example
    $this->cartWishlist->getUserCart($user_id);
}

```

---

Methods Overview
----------------

[](#methods-overview)

#### 1. storeItemToCart($item)

[](#1-storeitemtocartitem)

Here the parameter "$item" is an array which includes attributes like below,

```
$item = [
     'product_id' => 1,
     'user_id'    => 2,
     'quantity'   => 3,
     'unit_price' => 200,    //Nullable Field
     'total_price'=> 600    //Nullable Field
];

```

#### 2. updateItemToCart($cart\_id, $item)

[](#2-updateitemtocartcart_id-item)

Here the 1st parameter "$cart\_id" is an integer value of specific cart's id to update and the 2nd parameter "$item" is an array which includes attributes like below,

```
$item = [
     'quantity'   => 3,
     'unit_price' => 200,    //Nullable Field
     'total_price'=> 600    //Nullable Field
];

```

#### 3. getCart($cart\_id)

[](#3-getcartcart_id)

Here parameter "$cart\_id" is an integer value of specific cart's id to retrieve.

#### 4. getUserCart($user\_id)

[](#4-getusercartuser_id)

This function require user's id as parameter and retrieve all cart items for specific user.

#### 5. getAllCartItems()

[](#5-getallcartitems)

This function retrieve all cart items on the project.

#### 6. deleteCart($cart\_id)

[](#6-deletecartcart_id)

This function will delete specific cart item for a user. It requires cart's id as parameter.

#### 7. clearUserCart($user\_id)

[](#7-clearusercartuser_id)

This function will delete all cart items for a user. It requires user's id as parameter.

#### 8. storeItemToWishList($item)

[](#8-storeitemtowishlistitem)

Here the parameter "$item" is an array which includes attributes like below,

```
$item = [
    'product_id' => 1,
    'user_id'    => 2
];

```

#### 9. getUserWishList($user\_id)

[](#9-getuserwishlistuser_id)

This function require user's id as parameter and retrieve all wishlist items for specific user.

#### 10. deleteItemFromWishlist($wishlist\_id)

[](#10-deleteitemfromwishlistwishlist_id)

This function will delete specific wishlist item for a user. It requires wishlist's id as parameter.

#### 11. clearUserWishlist($user\_id)

[](#11-clearuserwishlistuser_id)

This function will delete all wishlist items for a user. It requires user's id as parameter.

---

---

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

MIT License

Copyright (c) 2023 || Developed by [Raisul Islam Hridoy](https://bd.linkedin.com/in/raisulhridoy)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Publisher
---------

[](#publisher)

### Raisul Hridoy

[](#raisul-hridoy)

###### Email:

[](#email-raisulhridoyhotmailcom)

###### Phone: (+880)-1686-851584

[](#phone-880-1686-851584)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1176d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e30b09b924d801c67e8a4439a34865ff1de09391e22641c71ed92c71ccd19f39?d=identicon)[hridoyraisul](/maintainers/hridoyraisul)

---

Top Contributors

[![hridoyraisul](https://avatars.githubusercontent.com/u/46390389?v=4)](https://github.com/hridoyraisul "hridoyraisul (6 commits)")

---

Tags

addtocartaddtowishlistcomposer-packagelaravellaravel-packagephpraisulhridoy

### Embed Badge

![Health badge](/badges/hridoyraisul-cartwishlistlaravel/health.svg)

```
[![Health](https://phpackages.com/badges/hridoyraisul-cartwishlistlaravel/health.svg)](https://phpackages.com/packages/hridoyraisul-cartwishlistlaravel)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
