Skip to content

LaravelEcomm ​

LaravelEcomm is an open source e-commerce application built with nwidart/laravel-modules. Its 29 modules under Modules/ cover the catalogue (Product, Category, Brand, Attribute), sales (Cart, Order, Billing, Coupon, Shipping), content (Post, Page, Banner) and a Front module for the storefront.

Analysed: commit 02d48b8, October 2026, Laravel 13.39, nwidart/laravel-modules 13.0, PHP 8.4. Cordon read the modules from their module.json files; no resolver configuration was needed.

Results ​

Default configPublic API declared
Modules2929
Files analysed1,0981,098
Cross-module references1,1421,142
internal_access777395
cycles127 dependencies in 1 group of 25 modules127 dependencies in 1 group of 25 modules
Time / memory2.6 s / 94 MB2.7 s / 92 MB

A shared kernel called Core ​

Almost half of the first report (379 of 777) pointed at one module. Core holds the base classes every module builds on:

ClassReferences
Core\Http\Requests\CoreRequest51
Core\Http\Controllers\Api\CoreController44
Core\Http\Requests\Api\CoreRequest44
Core\Models\Core43
Core\Http\Controllers\CoreController30
Core\Repositories\EloquentRepository28

That is a shared kernel, and Cordon expects it to be declared:

php
'public_namespaces' => ['Contracts', 'Events', 'Data', 'Enums', 'Exceptions', 'Interfaces', 'DTOs'],

'modules' => [
    'Core' => ['open' => true],
],

Marking Core as open removed 379 reports and DTOs another 3. (Interfaces made no difference here: all of them live in Core.)

What remains ​

The remaining 395 reports are mostly models used across modules:

ClassReferencesFrom modules
User\Models\User8725
Product\Models\Product5415
Order\Models\Order2511
Category\Models\Category189

User is a special case: 25 of its 87 references are policies, because Laravel passes the authenticated user to every policy method, and 11 are factories. Many teams would declare the user model public, or depend on Illuminate\Contracts\Auth\Authenticatable instead.

The storefront is the biggest consumer: Front uses Product internals 30 times, plus Category, Brand and Post. A storefront that reads every catalogue model directly is hard to change without touching the catalogue, which is where a small read API per module pays off (see expose a service).

27 reports come from or point at model factories (Database/Factories). Factories only support tests and seeders, so adding Factories to exclude is a reasonable choice for this app.

Cycles through Eloquent relations ​

25 of the 29 modules belong to one group of mutually dependent modules, with 34 direct back-and-forth pairs. Many of them are Eloquent relations declared on both sides:

php
// Modules/Product/Models/Product.php
return $this->hasMany(Cart::class);

// Modules/Cart/Models/Cart.php
return $this->belongsTo(Product::class);

Product knows about Cart, and Cart knows about Product. Relations are the most natural way to create a cycle in Laravel without noticing; the cross-module relations recipe shows how to keep only one direction.

MIT licensed. A community project, not affiliated with or endorsed by Laravel or Spring.