Introduction

Quick Start

Bootstrap a fresh Laravel project with OSDD in one command.

The fastest way to get started with OSDD is to use osdd:start on a fresh Laravel project.

osdd:start is a destructive command designed for fresh projects only. It deletes the app/, database/, and config/ directories. Never run it on an existing project with code you want to keep.

Step by Step

1. Create a fresh Laravel project

Terminal
composer create-project laravel/laravel my-app
cd my-app

2. Install Laravel OSDD

Terminal
composer require xefi/laravel-osdd

3. Run the bootstrap command

Terminal
php artisan osdd:start

The command will:

  1. Create functional/users layer with User model, factory, seeder, migration, and UsersServiceProvider
  2. Create technical/osdd layer with OsddServiceProvider and config
  3. Delete the legacy app/, database/, and config/ directories
  4. Clean up legacy PSR-4 entries (App\, Database\Factories\, Database\Seeders\) from root composer.json
  5. Rewrite bootstrap/providers.php to boot Technical\Osdd\Providers\OsddServiceProvider
  6. Register both layers as Composer path repositories in root composer.json
  7. Optionally run composer update

4. Your new structure

After the command completes, your project looks like this:

functional/
  users/
    composer.json
    src/
      Models/User.php
      Providers/UsersServiceProvider.php
    database/
      factories/UserFactory.php
      migrations/xxxx_create_users_table.php
      seeders/UsersSeeder.php
technical/
  osdd/
    composer.json
    src/
      Providers/OsddServiceProvider.php
    config/
bootstrap/
  providers.php   ← boots Technical\Osdd\Providers\OsddServiceProvider
composer.json     ← has path repos for both layers

Add Your First Layer

With the architecture in place, add a new domain layer:

Terminal
php artisan osdd:layer

You'll be prompted for:

  1. Which path bucket (functional or technical)
  2. The layer name (e.g. orders)
  3. Which generators to scaffold (migration, model, factory, etc.)

Then optionally run composer update functional/orders to register it.

See Creating Layers for full details on the osdd:layer command and all available generator options.