PHPackages                             theihasan/bagisto-wishlist-share - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. theihasan/bagisto-wishlist-share

ActiveBagisto-package[Utility &amp; Helpers](/categories/utility)

theihasan/bagisto-wishlist-share
================================

Enhanced wishlist sharing functionality for Bagisto with social media integration, QR codes, and comprehensive admin management

v1.0.2(9mo ago)011MITBladePHP ^8.1|^8.2|^8.3CI passing

Since Aug 11Pushed 9mo agoCompare

[ Source](https://github.com/theihasan/bagisto-wishlist-share)[ Packagist](https://packagist.org/packages/theihasan/bagisto-wishlist-share)[ Docs](https://github.com/theihasan/bagisto-wishlist-share)[ RSS](/packages/theihasan-bagisto-wishlist-share/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Bagisto Wishlist Share Package
==============================

[](#bagisto-wishlist-share-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5bd9ed017c1a46044d9b70b9217d3ff3513f4689be21619ba7c9c49303ef3d94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74686569686173616e2f6261676973746f2d776973686c6973742d73686172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theihasan/bagisto-wishlist-share)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3283a6bf0803d14cafa9595ed63638a07bd6c2dea8fcb31e3351d2b6c7523394/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74686569686173616e2f6261676973746f2d776973686c6973742d73686172652f62617369632d636865636b2e796d6c3f6272616e63683d6d61696e266c6162656c3d6261736963253230636865636b267374796c653d666c61742d737175617265)](https://github.com/theihasan/bagisto-wishlist-share/actions?query=workflow%3Atests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e5fa43808845fa4d0da8f8d12a248dcdd2f9e7553e4b25b8ddd62d9cf347a667/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74686569686173616e2f6261676973746f2d776973686c6973742d73686172652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/theihasan/bagisto-wishlist-share/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f24e5c0712c75d5afdd4b330dd89a9f643493739b0aae9ac54ed593b5a4814ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74686569686173616e2f6261676973746f2d776973686c6973742d73686172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theihasan/bagisto-wishlist-share)[![License](https://camo.githubusercontent.com/a7eda9872dda6c9fad78d361696ceebbc4dafc9642936973fb14f51f082122ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74686569686173616e2f6261676973746f2d776973686c6973742d73686172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theihasan/bagisto-wishlist-share)

Overview
--------

[](#overview)

The **Bagisto Wishlist Share** package is an enhanced wishlist sharing functionality for Bagisto e-commerce platform that allows customers to create shareable links for their wishlists with social media integration, QR code generation, and comprehensive admin management.

### **Package Structure**

[](#package-structure)

```
packages/Webkul/WishlistShare/
├── src/
│   ├── Config/                 # Configuration files
│   ├── Contracts/             # Interface contracts
│   ├── Database/              # Migrations and seeders
│   ├── Events/                # Event classes
│   ├── Http/                  # Controllers and requests
│   ├── Listeners/             # Event listeners
│   ├── Models/                # Eloquent models
│   ├── Providers/             # Service providers
│   ├── Repositories/          # Repository pattern
│   ├── Resources/
│   │   ├── assets/
│   │   │   ├── css/          # Package stylesheets
│   │   │   └── js/           # JavaScript files
│   │   │       └── wishlist-share-inject.js  # Universal injection script
│   │   ├── lang/             # Language files
│   │   └── views/            # Blade templates
│   │       ├── admin/        # Admin panel views
│   │       ├── customer/     # Customer-facing views
│   │       └── components/   # Reusable components
│   └── Routes/               # Route definitions
├── composer.json             # Package dependencies
├── package.json             # Frontend dependencies
└── README.md               # This documentation

```

### **Key Files**

[](#key-files)

- **`wishlist-share-inject.js`**: Universal theme compatibility script (published to `public/`)
- **`WishlistShareServiceProvider.php`**: Main service provider with auto-integration
- **`WishlistShare.php`**: Main model with sharing logic
- **`WishlistShareController.php`**: API and web controllers
- **`share-modal.blade.php`**: Modal component for sharing interface
- **`wishlist-share-integration.blade.php`**: Integration component for themes

Features
--------

[](#features)

### 🎯 Core Features

[](#-core-features)

- **Shareable Wishlist Links**: Generate unique, secure links for wishlist sharing
- **Social Media Integration**: Share wishlists on Facebook, Twitter, LinkedIn, and via email
- **QR Code Generation**: Automatic QR code creation for easy mobile sharing
- **Expiration Management**: Configurable expiration dates for shared wishlists
- **Privacy Controls**: Public/private wishlist sharing options
- **View Tracking**: Track how many times a shared wishlist has been viewed

### 📊 Admin Features

[](#-admin-features)

- **Analytics Dashboard**: Comprehensive analytics with date range filtering
- **Share Management**: View, manage, and delete customer wishlist shares
- **Bulk Operations**: Mass delete expired or selected shares
- **Export Functionality**: Export share data to CSV
- **Settings Configuration**: Customize button colors, labels, and social sharing options
- **Platform Statistics**: Track sharing across different social platforms

### 🎨 Frontend Features

[](#-frontend-features)

- **Modal Interface**: Clean, user-friendly sharing modal
- **Responsive Design**: Mobile-optimized sharing interface
- **Copy to Clipboard**: One-click link copying functionality
- **QR Code Display**: In-modal QR code generation and download
- **Social Sharing Buttons**: Direct sharing to social platforms

Installation &amp; Integration
------------------------------

[](#installation--integration)

### Requirements

[](#requirements)

- PHP ^8.2
- Laravel ^11.0
- Bagisto e-commerce platform (v2.0+)
- endroid/qr-code ^5.0
- Node.js &amp; NPM (for asset compilation)

### Step-by-Step Installation

[](#step-by-step-installation)

#### 1. **Install via Composer**

[](#1-install-via-composer)

```
composer require theihasan/bagisto-wishlist-share
```

#### 2. **Register Service Provider** (Auto-discovery enabled)

[](#2-register-service-provider-auto-discovery-enabled)

If auto-discovery is disabled, manually add to `config/app.php`:

```
'providers' => [
    // ...
    Ihasan\BagistoWishlistShare\Providers\WishlistShareServiceProvider::class,
],
```

#### 3. **Publish Package Resources**

[](#3-publish-package-resources)

```
# Publish all package resources
php artisan vendor:publish --provider="Ihasan\BagistoWishlistShare\Providers\WishlistShareServiceProvider"

# Or publish individually:
php artisan vendor:publish --tag=wishlist-share-config
php artisan vendor:publish --tag=wishlist-share-assets
php artisan vendor:publish --tag=wishlist-share-views
php artisan vendor:publish --tag=wishlist-share-lang
php artisan vendor:publish --tag=wishlist-share-inject
```

#### 4. **Run Database Migrations**

[](#4-run-database-migrations)

```
php artisan migrate
```

#### 5. **Compile Assets**

[](#5-compile-assets)

```
# If using Vite (Bagisto 2.0+)
npm run build

# Or if using Laravel Mix
npm run production
```

#### 6. **Clear Application Cache**

[](#6-clear-application-cache)

```
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan route:clear
```

#### 7. **Seed Sample Data** (Optional)

[](#7-seed-sample-data-optional)

```
php artisan db:seed --class="Ihasan\BagistoWishlistShare\Database\Seeders\WishlistShareSeeder"
```

### Integration into Existing Bagisto Project

[](#integration-into-existing-bagisto-project)

#### **Method 1: Package Installation (Recommended)**

[](#method-1-package-installation-recommended)

Follow the installation steps above. The package will automatically integrate with your existing Bagisto installation.

#### **Method 2: Manual Integration**

[](#method-2-manual-integration)

If you want to customize or integrate manually:

1. **Copy Package Files**

```
# Copy the package to your packages directory
cp -r vendor/theihasan/bagisto-wishlist-share packages/Webkul/WishlistShare
```

2. **Update Composer.json**

```
{
    "autoload": {
        "psr-4": {
            "Ihasan\\BagistoWishlistShare\\": "packages/Webkul/WishlistShare/src/"
        }
    }
}
```

3. **Register in packages.php**Add to `config/concord.php`:

```
'modules' => [
    // ... existing modules
    Ihasan\BagistoWishlistShare\Providers\ModuleServiceProvider::class,
]
```

#### **Method 3: Development Setup**

[](#method-3-development-setup)

For package development:

1. **Clone Repository**

```
git clone https://github.com/theihasan/bagisto-wishlist-share.git packages/Webkul/WishlistShare
```

2. **Install Dependencies**

```
cd packages/Webkul/WishlistShare
composer install
npm install
```

3. **Build Assets**

```
npm run build
```

### Post-Installation Configuration

[](#post-installation-configuration)

#### **1. Environment Variables**

[](#1-environment-variables)

Add to your `.env` file:

```
# Wishlist Share Configuration
WISHLIST_SHARE_ENABLED=true
WISHLIST_SHARE_TOKEN_LENGTH=32
WISHLIST_SHARE_EXPIRES_DAYS=30
WISHLIST_SHARE_QR_SIZE=200
```

#### **2. Admin Configuration**

[](#2-admin-configuration)

1. Login to Bagisto Admin Panel
2. Navigate to **Configuration → Wishlist Share**
3. Configure social sharing settings
4. Set button colors and labels
5. Enable/disable features as needed

#### **3. Theme Integration**

[](#3-theme-integration)

The package automatically integrates with the default Bagisto theme. For custom themes:

**Add to your wishlist template:**

```
@if(config('wishlist-share.enabled'))
    @wishlistShare
    @wishlistShareAssets
@endif
```

**Or manually include:**

```
@include('wishlist-share::customer.share-modal')
```

#### **4. Custom Styling**

[](#4-custom-styling)

Override default styles by publishing views and modifying:

```
php artisan vendor:publish --tag=wishlist-share-views
```

Edit: `resources/views/vendor/wishlist-share/customer/share-modal.blade.php`

Configuration
-------------

[](#configuration)

### Basic Configuration

[](#basic-configuration)

The package configuration is located at `config/wishlist-share.php`:

```
return [
    'enabled' => true,

    'social_platforms' => [
        'facebook' => [
            'enabled' => true,
            'url' => 'https://www.facebook.com/sharer/sharer.php?u=',
        ],
        'twitter' => [
            'enabled' => true,
            'url' => 'https://twitter.com/intent/tweet?url=',
        ],
        'linkedin' => [
            'enabled' => true,
            'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=',
        ],
        'email' => [
            'enabled' => true,
            'subject' => 'Check out my wishlist',
        ],
    ],

    'qr_code' => [
        'enabled' => true,
        'size' => 200,
        'margin' => 10,
    ],

    'share_token' => [
        'length' => 32,
        'expires_in_days' => 30,
    ],
];
```

### Admin Settings

[](#admin-settings)

Access admin settings via: **Admin Panel → Wishlist Share → Settings**

Configure:

- Button colors and labels
- Social sharing button colors
- Add to wishlist button customization
- View product button customization

Database Schema
---------------

[](#database-schema)

### wishlist\_shares Table

[](#wishlist_shares-table)

```
- id (Primary Key)
- customer_id (Foreign Key to customers table)
- share_token (Unique 64-character string)
- title (Nullable string)
- description (Nullable text)
- is_public (Boolean, default: true)
- expires_at (Nullable timestamp)
- view_count (Integer, default: 0)
- shared_platforms (JSON, nullable)
- created_at, updated_at (Timestamps)
```

### wishlist\_share\_items Table

[](#wishlist_share_items-table)

```
- id (Primary Key)
- wishlist_share_id (Foreign Key to wishlist_shares table)
- product_id (Foreign Key to products table)
- product_options (JSON, nullable)
- quantity (Integer, default: 1)
- created_at, updated_at (Timestamps)
```

API Endpoints
-------------

[](#api-endpoints)

### Customer API Routes (Authenticated)

[](#customer-api-routes-authenticated)

- `POST /api/wishlist-share/create` - Create a new wishlist share
- `GET /api/wishlist-share/my-shares` - Get user's wishlist shares

### Public API Routes

[](#public-api-routes)

- `GET /api/wishlist-share/{token}` - View shared wishlist data

### Web Routes

[](#web-routes)

- `POST /customer/account/wishlist/share/create` - Create wishlist share
- `GET /customer/account/wishlist/share/{token}/qr` - Generate QR code
- `DELETE /customer/account/wishlist/share/{token}` - Delete wishlist share
- `GET /shared-wishlist/{token}` - View shared wishlist page

Developer Integration Guide
---------------------------

[](#developer-integration-guide)

### **Integration Methods**

[](#integration-methods)

The package provides multiple integration methods to work with different Bagisto themes and customization needs:

#### **Method 1: Automatic Integration (Recommended)**

[](#method-1-automatic-integration-recommended)

The package automatically integrates with the default Bagisto wishlist page by:

- Adding a "Share Wishlist" button next to the "Delete All" button
- Including the share modal and injection script
- Using the `wishlist-share-inject.js` for universal theme compatibility

#### **Method 2: Component Integration**

[](#method-2-component-integration)

```

@include('wishlist-share::components.wishlist-share-integration', [
    'buttonPosition' => 'inline',     // 'inline' or 'floating'
    'showInlineButton' => true,       // Show additional inline button
    'floatingPosition' => [           // Custom floating position
        'top' => '150px',
        'right' => '20px'
    ]
])
```

#### **Method 3: Manual Integration**

[](#method-3-manual-integration)

```

    @if(auth('customer')->check() && config('wishlist-share.enabled'))

             Share Wishlist

    @endif

@include('wishlist-share::customer.share-modal')

```

### **Frontend Integration**

[](#frontend-integration)

#### **1. Adding Share Button to Custom Templates**

[](#1-adding-share-button-to-custom-templates)

```

    @if(auth('customer')->check() && config('wishlist-share.enabled'))

             Share Wishlist

    @endif

@wishlistShare
@wishlistShareAssets
```

#### **2. JavaScript Integration**

[](#2-javascript-integration)

```
// Custom share button handler
function openWishlistShareModal() {
    document.getElementById('wishlist-share-modal').style.display = 'flex';
}

// Listen for share events
document.addEventListener('wishlist-shared', function(event) {
    console.log('Wishlist shared:', event.detail);
    // Custom tracking or analytics
});
```

#### **3. CSS Customization**

[](#3-css-customization)

```
/* Override default styles */
.wishlist-share-modal {
    /* Custom modal styles */
}

.wishlist-share-btn {
    background-color: var(--primary-color);
    /* Custom button styles */
}
```

### **Backend Integration**

[](#backend-integration)

#### **1. Custom Controller Integration**

[](#1-custom-controller-integration)

```
