Search by

damoscky / ecommerce

Damoscky

Adds the ecommerce package to package.app

v1.0.1 2026-11-29 09:08 UTC

This package is auto-updated.

Last update: 2026-12-01 10:46:58 UTC


README

A Laravel package that adds a full ecommerce API to a Laravel application — products, categories, carts, wishlists, orders, subscriptions/recurring orders, shipping & logistics, vendors, customers, complaints, banners, newsletters, reporting/exports and an admin dashboard. Routes, migrations and views are auto-registered via Laravel package discovery.

  • Package name: damoscky/ecommerce
  • Root namespace: Damoscky\Ecommerce
  • Service provider: Damoscky\Ecommerce\EcommerceServiceProvider (auto-discovered)

Requirements

  • PHP 8.x
  • Laravel (with the api route middleware group)
  • The host application's App\Models\User model must support roles via a hasRole() method — e.g. spatie/laravel-permission. The seeders reference App\Models\User directly.
  • tymon/jwt-auth for the api auth guard.

Bundled dependencies (installed automatically):

  • tymon/jwt-auth ^2.0
  • maatwebsite/excel ^3.1 (report exports)
  • jenssegers/agent ^2.6

Installation

This package is published on Packagist.

1. Require the package

composer require damoscky/ecommerce

Installing a tagged release requires the package to have at least one Git tag (e.g. v1.0.0). Until a stable version is tagged, install the development branch with composer require damoscky/ecommerce:dev-review.

The EcommerceServiceProvider is registered automatically through Laravel's package discovery (extra.laravel.providers in the package's composer.json) — no manual registration needed.

2. Set up JWT authentication

php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
php artisan jwt:secret

Point the api guard at the JWT driver in config/auth.php:

'guards' => [
    'api' => [
        'driver'   => 'jwt',
        'provider' => 'users',
    ],
],

3. Register the middleware aliases

The package's route groups use these aliases — register them in your app's HTTP kernel (app/Http/Kernel.php, in $middlewareAliases / $routeMiddleware):

use Damoscky\Ecommerce\Http\Middleware\EcommerceCustomerMiddleware;
use Damoscky\Ecommerce\Http\Middleware\EcommerceVendorMiddleware;
use Damoscky\Ecommerce\Http\Middleware\EcommerceSuperAdminMiddleware;
use Damoscky\Ecommerce\Http\Middleware\EcommerceAdminMiddleware;

protected $middlewareAliases = [
    // ...
    'ecommercecustomer'   => EcommerceCustomerMiddleware::class,
    'ecommercevendor'     => EcommerceVendorMiddleware::class,
    'ecommercesuperadmin' => EcommerceSuperAdminMiddleware::class,
    'ecommerceadmin'      => EcommerceAdminMiddleware::class,
];

4. Run the migrations

The package ships 28 migrations and loads them automatically, so they run with your normal migrate command:

php artisan migrate

5. Seed roles, permissions and base data (optional but recommended)

php artisan db:seed --class="Damoscky\Ecommerce\Database\Seeders\EcommerceRoleSeeder"
php artisan db:seed --class="Damoscky\Ecommerce\Database\Seeders\EcommercePermissionsTableSeeder"
php artisan db:seed --class="Damoscky\Ecommerce\Database\Seeders\EcommerceCategorySeeder"

Publishing assets (optional)

Override the package's assets by publishing them with the relevant tag:

# Config
php artisan vendor:publish --tag=ecommerce-config

# Blade views -> resources/views/vendor/ecommerce
php artisan vendor:publish --tag=ecommerce-views

# Migrations -> database/migrations
php artisan vendor:publish --tag=ecommerce-migrations

Usage

Once installed, the API is served under the base path:

/api/v1/ecommerce/...

(The outer api prefix is added by the service provider; the inner v1/ecommerce prefix is defined in the package routes.)

Route groups

Prefix Auth / middleware Purpose
api/v1/ecommerce/guest/... public Browse products, subscribe
api/v1/ecommerce/customer/... auth:api + ecommercecustomer Cart, wishlist, orders, profile
api/v1/ecommerce/vendor/... auth:api + ecommercevendor Vendor registration & tools
api/v1/ecommerce/admin/... auth:api + ecommercesuperadmin Dashboard, products, reports

Example requests

# Public: list products
curl https://your-app.test/api/v1/ecommerce/guest/products

# Authenticated customer: view cart (JWT bearer token required)
curl https://your-app.test/api/v1/ecommerce/customer/cart \
  -H "Authorization: Bearer <jwt-token>"

# Clear the package cache
curl https://your-app.test/api/v1/ecommerce/clear-cache

Using models directly

All domain models live under Damoscky\Ecommerce\Models:

use Damoscky\Ecommerce\Models\EcommerceProduct;
use Damoscky\Ecommerce\Models\EcommerceOrder;

$products = EcommerceProduct::query()->paginate();

Upgrading from sbscphp/ecommerce

This package was renamed from sbscphp/ecommerce (namespace SbscPackage\Ecommerce). If you were using the old package, update your application accordingly:

  • composer require sbscphp/ecommerce → composer require damoscky/ecommerce
  • If you installed the old package from a VCS repositories entry, remove it — the package now resolves directly from Packagist.
  • Replace any imports of SbscPackage\Ecommerce\... with Damoscky\Ecommerce\....

The service provider is auto-discovered, so no change is needed if you relied on package discovery. Config keys, publish tags (ecommerce-config, ecommerce-views, ecommerce-migrations) and the Ecommerce view namespace are unchanged.

Author

Damilola Akinwunmi · akinwunmi.damilola@yahoo.com