Guides

Production

Deploy an OSDD application so no request scans the layer folders, and know which cache to rebuild after a change.

An OSDD application deploys like any Laravel application. php artisan optimize caches everything the layers add:

composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan optimize

What optimize caches

CacheCommand run by optimizeHolds for the layers
Layersosdd:cacheThe discovered layers, in bootstrap/cache/osdd.php
Configconfig:cacheThe result of every overrideConfigFrom()
Routesroute:cacheThe web, api and health routes of every withRouting()
Eventsevent:cacheThe discovered layer listeners
Viewsview:cacheThe Blade views of every layer

Skip the layer cache with php artisan optimize --except=osdd, and clear everything with php artisan optimize:clear.

After a change

Each cache keeps its content until it is rebuilt. Run php artisan optimize again after:

  • changing a layer's config file: overrideConfigFrom() does nothing once the config is cached;
  • changing a layer's web.php or api.php. The console.php and channels.php files are still loaded with cached routes;
  • adding a listener while event discovery is on;
  • removing a layer with osdd:remove: the caches still name its classes.

The layer cache refreshes itself after composer install and composer update. A layer copied in by hand, without Composer, stays invisible until php artisan osdd:cache or osdd:clear.

Deploying with --no-scripts

composer install --no-scripts skips php artisan package:discover, so Laravel does not discover the providers of new layers and the layer cache is not refreshed. Run php artisan package:discover yourself before optimize.