Deploying a modular Laravel application is practically identical to deploying a standard one, with one additional optimization step.
composer install is run (autoloads modules).npm run build is run (builds module assets).bootstrap/cache directory is writable.In your deployment script (Forge, Envoyer, GitHub Actions), add this after composer install:
# 1. Standard Laravel optimizations
php artisan config:cache
php artisan route:cache
php artisan view:cache
# 2. Modular optimization (Crucial!)
php artisan modular:cache
modular:cache doesIt scans all your enabled modules and compiles a bootstrap/cache/modular.php file.
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress
- name: Run Tests
# Runs tests for ALL modules + Core app
run: php artisan test
You can add these steps to control code quality:
# 1. Check for circular dependencies
php artisan modular:check
# 2. Run module-specific tests (optional matrix strategy)
php artisan modular:test Shop
If you deploy and a module seems missing:
php artisan modular:list to check status.bootstrap/cache/modules_statuses.json. This file persists enabled/disabled state. Git ignore this file so you don't accidentally disable modules in production that were disabled locally.php artisan modular:clear to ask the system to rescan.If a module class isn't found:
composer dump-autoload -o ran.module.json, you must update composer.json autoload paths or re-run modular:cache.How can I help you explore Laravel packages today?