What are Layers?
A layer is the core unit of OSDD architecture. Every layer is a standard Composer package that lives inside either functional/ or technical/ at your project root.
Anatomy of a Layer
functional/orders/
├── composer.json ← Composer package definition
└── src/
├── Models/
│ └── Order.php
├── Http/
│ └── Controllers/
│ └── OrderController.php
├── Policies/
│ └── OrderPolicy.php
└── Providers/
└── OrdersServiceProvider.php
├── database/
│ ├── migrations/
│ │ └── xxxx_create_orders_table.php
│ ├── factories/
│ │ └── OrderFactory.php
│ └── seeders/
│ └── OrdersSeeder.php
└── tests/
└── OrderTest.php
What Makes a Directory a Valid Layer
OSDD identifies a directory as a layer when it contains a composer.json with "type": "layer":
{
"name": "functional/orders",
"type": "layer",
"autoload": {
"psr-4": {
"Functional\\Orders\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Functional\\Orders\\Providers\\OrdersServiceProvider"
]
}
}
}
extra.laravel.providers entry enables Laravel's package auto-discovery to boot the layer's service provider automatically after composer update.Layer Discovery
OSDD discovers layers by scanning the paths defined in config/osdd.php:
'layers' => [
'paths' => [
'functional' => base_path('functional'),
'technical' => base_path('technical'),
]
]
The scanner traverses one level deep by default. If a sub-directory does not contain a composer.json with "type": "layer", it recurses one level further — so you can group layers under category folders without those folders needing to be layers themselves.
functional vs technical
| Bucket | Purpose | Examples |
|---|---|---|
functional/ | Business domain concerns | users, orders, billing, notifications |
technical/ | Infrastructure and cross-cutting concerns | osdd, auth, queue-config, event-bus |
This distinction is entirely organizational — OSDD treats both buckets the same way technically.
Layer Registration
When osdd:layer or osdd:start creates a layer, it automatically:
- Adds a Composer
pathrepository entry pointing to the layer directory - Adds
"vendor/package": "*"torequirein rootcomposer.json - Injects the service provider into the layer's own
composer.jsonunderextra.laravel.providers
After composer update vendor/package, Laravel auto-discovers and boots the service provider — no changes to bootstrap/providers.php needed.