Installation
Requirements: PHP 8.3+ and Laravel 12 or 13.
bash
composer require --dev chrisabner/cordon-modulithCheck what was detected
Cordon Modulith detects your module layout automatically:
bash
php artisan cordon:modulestext
Resolver: namespace
+---------+---------------------+---------------------+----------------+------+
| Module | Namespace | Path | Depends on | Open |
+---------+---------------------+---------------------+----------------+------+
| Billing | App\Modules\Billing | app/Modules/Billing | (not declared) | no |
| Catalog | App\Modules\Catalog | app/Modules/Catalog | (not declared) | no |
+---------+---------------------+---------------------+----------------+------+With a plain app/Modules folder you see Resolver: namespace, as above. With nwidart/laravel-modules the same command prints Resolver: nwidart:
text
Resolver: nwidart
+----------+------------------+-----------------+----------------+------+
| Module | Namespace | Path | Depends on | Open |
+----------+------------------+-----------------+----------------+------+
| Billing | Modules\Billing | Modules/Billing | (not declared) | no |
| Catalog | Modules\Catalog | Modules/Catalog | (not declared) | no |
+----------+------------------+-----------------+----------------+------+| Resolver | Detected when | Module | Namespace |
|---|---|---|---|
nwidart | Modules/*/module.json exists | Modules/Blog → Blog | Modules\Blog (from config/modules.php) |
internachi | app-modules/ exists | app-modules/billing → billing | from the module's composer.json PSR-4 entry |
namespace | fallback | app/Modules/Billing → Billing | App\Modules\Billing |
If nothing is found, publish the config and set the resolver and its path (see Configuration).
Verify
bash
php artisan cordon:verifyIt exits with 1 when there are violations, 0 otherwise and 2 on invalid options.
Publish the config (optional)
bash
php artisan vendor:publish --tag=cordon-configNext: understand the public API of a module, or adopt it in an existing project if the first run reports many violations.