jmrashed / ecommerce
Advanced E-commerce Toolkit for Laravel Application
Requires
- php: ^8.2
- ext-json: *
- darkaonline/l5-swagger: ^8.5|^9.0|^10.0
- laravel/framework: ^10.0|^11.0|^12.0|^13.0
- laravel/sanctum: ^3.0|^4.0
Requires (Dev)
- fakerphp/faker: ^1.23
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.23
- phpunit/phpunit: ^10.5
Suggests
- stripe/stripe-php: Required for Stripe payment gateway support
README
Introduction
The Advanced E-commerce Toolkit is a comprehensive Laravel package that provides everything needed to build a full-featured online store. It includes product catalog management (with variants/attributes), shopping cart, wishlist, checkout flow, Stripe/PayPal payments, order management, customer dashboards, admin panel, API endpoints, inventory tracking, coupons, reviews, shipping zones, loyalty points, and more.
Key benefits:
- Production-ready with migrations, factories, seeders, tests.
- Modular services (CartService, OrderService, PaymentService).
- Responsive Blade views for frontend + API support.
- Easy installation via Artisan commands.
Perfect for Laravel developers building SaaS, marketplaces, or custom stores.
Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^10.0 |^11.0 |^12.0 |^13.0 |
| Laravel Sanctum | ^3.0 |^4.0 |
| darkaonline/l5-swagger | ^8.5 |^9.0 |^10.0 |
Optional (suggested):
stripe/stripe-phpfor Stripe payments.
Installation
-
Install via Composer:
composer require jmrashed/ecommerce
-
Install package (registers provider, publishes assets):
php artisan ecommerce:install
Or manually:
php artisan vendor:publish --provider=\"Jmrashed\\Ecommerce\\EcommerceServiceProvider\" --tag=ecommerce-config php artisan vendor:publish --tag=ecommerce-views php artisan vendor:publish --tag=ecommerce-assets
-
Run migrations:
php artisan migrate
-
(Optional) Seed demo data:
php artisan ecommerce:seed
Configuration
Copy config/ecommerce.php and update .env:
# Payments STRIPE_KEY=pk_test_xxx STRIPE_SECRET=sk_test_xxx PAYPAL_CLIENT_ID=xxx PAYPAL_SECRET=xxx # Store ECOMMERCE_CURRENCY=USD ECOMMERCE_TAX_RATE=0.08 ECOMMERCE_DEFAULT_SHIPPING=5.00 # Other (full list in config/ecommerce.php)
Usage Examples
Products & Cart
use Jmrashed\Ecommerce\Services\CartService; use Jmrashed\Ecommerce\Models\Product; // Add to cart $cartService = app(CartService::class); $cartService->add(1, 2); // product ID, quantity // Totals with tax/shipping $total = $cartService->getTotal(); $tax = $cartService->calculateTax($subtotal);
Checkout & Orders
use Jmrashed\Ecommerce\Services\OrderService; // Create order from cart $order = $orderService->createFromCart($userId, $address);
Payments
use Jmrashed\Ecommerce\Services\PaymentService; $paymentService = app(PaymentService::class); $payment = $paymentService->processStripe($order, $token);
Full API: /api/ecommerce/products, /api/ecommerce/cart, etc.
Publishing Assets
php artisan vendor:publish --tag=ecommerce-views # Blade templates
php artisan vendor:publish --tag=ecommerce-assets # CSS/JS
Key Features Tables
Models
| Model | Purpose |
|---|---|
| Product | Catalog with images, variants, attributes |
| Category/Brand/Tag | Organization |
| CartItem/Wishlist | Session-based |
| Order/OrderItem | Full lifecycle |
| Payment/Refund | Gateways |
| Customer/Address | Accounts |
| Review/Coupon | Engagement |
Services
| Service | Features |
|---|---|
| CartService | Add/remove, totals, tax/shipping calc |
| OrderService | Create, status update |
| PaymentService | Stripe/PayPal/COD |
| ProductService | Search/filter |
Routes
Web: /products, /cart, /checkout, /customer/*, /admin/ecommerce/*
API: /api/ecommerce/* (auth/products/cart/orders/payments)
Testing
composer test # All tests composer test:unit # Unit composer test:feature # Feature composer test:coverage # Coverage report
Scripts use ./run-tests.sh.
Contributing
See CONTRIBUTING.md.
Security
Report to SECURITY.md or jmrashed@gmail.com.
Changelog
License
MIT. See LICENSE.
⭐ Star on GitHub