Buckets
A bucket is a folder listed in osdd.layers.paths. OSDD looks for layers in the buckets only. There are two by default:
'layers' => [
'paths' => [
'functional' => base_path('functional'),
'technical' => base_path('technical'),
],
],
The key of each bucket is also the vendor of the layers created in it: osdd:layer functional/orders creates functional/orders, and osdd:layer technical/auth creates technical/auth. In a terminal, osdd:layer without a name asks which bucket to use.
functional or technical
| Bucket | Holds | Examples |
|---|---|---|
functional/ | Business domains. A domain owns its models, rules, HTTP layer and tests. | users, orders, billing |
technical/ | Infrastructure shared by several domains, with no business meaning. | osdd, auth, feature-flags |
OSDD handles both buckets the same way: the split is organizational. Avoid catch-all layers such as common or shared: they end up holding everything, and every other layer depends on them.
How layers are found
OSDD scans every bucket. A sub-folder whose composer.json has "type": "layer" is a layer. A sub-folder without a composer.json is scanned in turn, so you can group layers:
functional/
billing/
invoices/ ← layer "functional/invoices"
composer.json
payments/ ← layer "functional/payments"
composer.json
orders/ ← layer "functional/orders"
composer.json
A folder with a composer.json stops the scan: OSDD never looks for layers inside a layer, nor inside a package of another type.
The layers are always sorted by name. They are discovered once per process; php artisan optimize caches them for production.
Adding a bucket
Add a path to technical/osdd/config/osdd.php:
return [
'layers' => [
'paths' => [
'functional' => base_path('functional'),
'technical' => base_path('technical'),
'support' => base_path('support'),
],
],
];
osdd:layer support/mailing now creates the layer in support/ and registers a ./support/* path repository with the first layer you create there.
Without a terminal, a vendor that matches no bucket fails: The vendor [acme] matches no key of osdd.layers.paths (functional, technical). Name the layer after one of them, or pass --target-path.