Skip to content

Releases: lunarstorm/laravel-ddd

v1.2.0

23 Nov 06:24
5980ead
Compare
Choose a tag to compare

🔥 1.2 is a major update with several new features and breaking changes (for some). Use php artisan ddd:config update to rebuild your existing config file according to the latest version, and be sure to review the Upgrade Guide for full details about upgrading from 1.1.x.

[1.2.0] - 2024-11-23

Breaking

  • Stubs are now published to base_path('stubs/ddd') instead of resource_path('stubs/ddd'). In other words, they are now co-located alongside the framework's published stubs, within a ddd subfolder.
  • Published stubs now use .stub extension instead of .php.stub (following Laravel's convention).
  • If you are using published stubs from pre 1.2, you will need to refactor your stubs accordingly.

Added

  • Support for the Application Layer, to generate domain-specific objects that don't belong directly in the domain layer:
    // In config/ddd.php
    'application_path' => 'app/Modules',
    'application_namespace' => 'App\Modules',
    'application_objects' => [
        'controller',
        'request',
        'middleware',
    ],
  • Support for Custom Layers, additional top-level namespaces of your choosing, such as Infrastructure, Integrations, etc.:
    // In config/ddd.php
    'layers' => [
        'Infrastructure' => 'src/Infrastructure',
    ],
  • Added config utility command ddd:config to help manage the package's configuration over time.
  • Added stub utility command ddd:stub to publish one or more stubs selectively.
  • Added ddd:controller to generate domain-specific controllers.
  • Added ddd:request to generate domain-spefic requests.
  • Added ddd:middleware to generate domain-specific middleware.
  • Added ddd:migration to generate domain migrations.
  • Added ddd:seeder to generate domain seeders.
  • Added ddd:stub to manage stubs.
  • Migration folders across domains will be registered and scanned when running php artisan migrate, in addition to the standard application database/migrations path.
  • Ability to customize generator object naming conventions with your own logic using DDD::resolveObjectSchemaUsing().

Changed

  • ddd:model now extends Laravel's native make:model and inherits all standard options:
    • --migration|-m
    • --factory|-f
    • --seed|-s
    • --controller --resource --requests|-crR
    • --policy
    • -mfsc
    • --all|-a
    • --pivot|-p
  • ddd:cache is now ddd:optimize (ddd:cache is still available as an alias).
  • Since Laravel 11.27.1, the framework's optimize and optimize:clear commands will automatically invoke ddd:optimize (ddd:cache) and ddd:clear respectively.

Deprecated

  • Domain base models are no longer required by default, and config('ddd.base_model') is now null by default.
  • Stubs are no longer published via php artisan vendor:publish --tag="ddd-stubs". Instead, use php artisan ddd:stub to manage them.

What's Changed

Full Changelog: v1.1.3...v1.2.0

v1.2.0-beta.3

18 Nov 02:45
7f23d72
Compare
Choose a tag to compare
v1.2.0-beta.3 Pre-release
Pre-release

The final v1.2.0 pre-release, which adds support for custom layers (e.g., Infrastructure), finalizes the config conventions, adds a ddd:config utility command, and more.

To use this version now:

composer require lunarstorm/laravel-ddd:dev-next 

Full 1.2.0 Changelog:

Upgrade guide: https://github.com/lunarstorm/laravel-ddd/blob/next/UPGRADING.md

Breaking

  • Stubs are now published to base_path('stubs/ddd') instead of resource_path('stubs/ddd'). In other words, they are now co-located alongside the framework's published stubs, within a ddd subfolder.
  • Published stubs now use .stub extension instead of .php.stub (following Laravel's convention).
  • If you are using published stubs from pre 1.2, you will need to refactor your stubs accordingly.

Added

  • Support for the Application Layer, to generate domain-specific objects that don't belong directly in the domain layer:
    // In config/ddd.php
    'application_path' => 'app/Modules',
    'application_namespace' => 'App\Modules',
    'application_objects' => [
        'controller',
        'request',
        'middleware',
    ],
  • Support for Custom Layers, additional top-level namespaces of your choosing, such as Infrastructure, Integrations, etc.:
    // In config/ddd.php
    'layers' => [
        'Infrastructure' => 'src/Infrastructure',
    ],
  • Added config utility command ddd:config to help manage the package's configuration over time.
  • Added stub utility command ddd:stub to publish one or more stubs selectively.
  • Added ddd:controller to generate domain-specific controllers.
  • Added ddd:request to generate domain-spefic requests.
  • Added ddd:middleware to generate domain-specific middleware.
  • Added ddd:migration to generate domain migrations.
  • Added ddd:seeder to generate domain seeders.
  • Added ddd:stub to manage stubs.
  • Migration folders across domains will be registered and scanned when running php artisan migrate, in addition to the standard application database/migrations path.
  • Ability to customize generator object naming conventions with your own logic using DDD::resolveObjectSchemaUsing().

Changed

  • ddd:model now extends Laravel's native make:model and inherits all standard options:
    • --migration|-m
    • --factory|-f
    • --seed|-s
    • --controller --resource --requests|-crR
    • --policy
    • -mfsc
    • --all|-a
    • --pivot|-p
  • ddd:cache is now ddd:optimize (ddd:cache is still available as an alias).
  • Since Laravel 11.27.1, the framework's optimize and optimize:clear commands will automatically invoke ddd:optimize (ddd:cache) and ddd:clear respectively.

Deprecated

  • Domain base models are no longer required by default, and config('ddd.base_model') is now null by default.
  • Stubs are no longer published via php artisan vendor:publish --tag="ddd-stubs". Instead, use php artisan ddd:stub to manage them.

What's Changed

Full Changelog: v1.2.0-beta.2...v1.2.0-beta.3

v1.2.0-beta.2

10 Nov 05:56
3c73e2d
Compare
Choose a tag to compare
v1.2.0-beta.2 Pre-release
Pre-release

A second v1.2.0 pre-release, which refactors the customization of stubs and introduces a more user friendly ddd:stub command to publish one or more stubs selectively. To use this version now:

composer require lunarstorm/laravel-ddd:dev-next 

Full summary of changes from v1.1.x below.

Breaking

  • Stubs are now published to base_path('stubs/ddd') instead of resource_path('stubs/ddd'). In other words, they are now co-located alongside the framework's published stubs, within a ddd subfolder.
  • Normalize published stubs to use .stub extension instead of .php.stub (following Laravel's convention).

Added

  • Ability to configure the Application Layer, to generate domain objects that don't typically belong inside the domain layer.
    // In config/ddd.php
    'application' => [
        'path' => 'app/Modules',
        'namespace' => 'App\Modules',
        'objects' => [
            'controller',
            'request',
            'middleware',
        ],
    ],
  • Added ddd:controller to generate domain-specific controllers in the application layer.
  • Added ddd:request to generate domain-spefic requests in the application layer.
  • Added ddd:middleware to generate domain-specific middleware in the application layer.
  • Added ddd:migration to generate domain migrations.
  • Added ddd:seeder to generate domain seeders.
  • Added ddd:publish to publish the config or stubs in a more user friendly manner.
  • Added ddd:stub to list, search, and publish one or more stubs as needed.
  • Migration folders across domains will be registered and scanned when running php artisan migrate, in addition to the standard application database/migrations path.

Changed

  • ddd:model now internally extends Laravel's native make:model and inherits all standard options:
    • --migration|-m
    • --factory|-f
    • --seed|-s
    • --controller --resource --requests|-crR
    • --policy
    • -mfsc
    • --all|-a
    • --pivot|-p
  • ddd:cache is now ddd:optimize (ddd:cache is still available as an alias).
  • For Laravel 11.27.1+, the framework's optimize and optimize:clear commands will automatically invoke ddd:optimize and ddd:clear respectively.
  • Normalize stubs to use .stub extension instead of .php.stub (following Laravel's convention).
  • For ddd:* generators that inherit Laravel's stubs, custom stubs will be resolved as follows:
    • Try stubs/ddd/*.stub (allows customizing stub for ddd only)
    • Try stubs/*.stub (shared by both make:* and ddd:*)
    • Fallback to the framework or package default

Deprecated

  • Domain base models are no longer required by default, and config('ddd.base_model') is now null by default.
  • Removed ddd-specific model stub, now that ddd:model extends laravel's make:model and therefore inherits the native stubs.

What's Changed

Full Changelog: v1.1.3...v1.2.0-beta.2

v1.1.3

05 Nov 16:49
f834953
Compare
Choose a tag to compare

[1.1.3] - 2024-11-05

Chore

  • Allow laravel/prompts dependency to use latest version when possible.

What's Changed

Full Changelog: v1.1.2...v1.1.3

v1.2.0-beta.1

22 Oct 13:59
c944c79
Compare
Choose a tag to compare
v1.2.0-beta.1 Pre-release
Pre-release

There are still a few things to iron out before a final 1.2.0 release, but I wanted to get this out as a pre-release for now to keep things moving.

Added

  • Experimental: Ability to configure the Application Layer, to generate domain objects that don't typically belong inside the domain layer.
    // In config/ddd.php
    'application' => [
        'path' => 'app/Modules',
        'namespace' => 'App\Modules',
        'objects' => [
            'controller',
            'request',
            'middleware',
        ],
    ],
  • Added ddd:controller to generate domain-specific controllers in the application layer.
  • Added ddd:request to generate domain-spefic requests in the application layer.
  • Added ddd:middleware to generate domain-specific middleware in the application layer.
  • Added ddd:migration to generate domain migrations.
  • Added ddd:seeder to generate domain seeders.
  • Migration folders across domains will be registered and scanned when running php artisan migrate, in addition to the standard application database/migrations path.

Changed

  • ddd:model now internally extends Laravel's native make:model and inherits all standard options:
    • --migration|-m
    • --factory|-f
    • --seed|-s
    • --controller --resource --requests|-crR
    • --policy
    • -mfsc
    • --all|-a
    • --pivot|-p
  • ddd:cache is now ddd:optimize (ddd:cache is still available as an alias).
  • For Laravel 11.27.1+, the framework's optimize and optimize:clear commands will automatically invoke ddd:optimize and ddd:clear respectively.

Deprecated

  • Domain base models are no longer required by default, and config('ddd.base_model') is now null by default.

What's Changed

  • [1.2] ddd:model options, migrations, application layer by @JasperTey in #69

Full Changelog: v1.1.2...v1.2.0-beta.1

v1.1.2

03 Sep 02:21
c213e3e
Compare
Choose a tag to compare

[1.1.2] - 2024-09-02

Fixed

  • During domain factory autoloading, ensure that guessFactoryNamesUsing returns a string when a domain factory is resolved.
  • Resolve issues with failing tests caused by mutations to composer.json that weren't rolled back.

What's Changed

New Contributors

Full Changelog: v1.1.1...v1.1.2

v1.1.1

17 Apr 13:01
d58177d
Compare
Choose a tag to compare

[1.1.1] - 2024-04-17

Added

  • Ability to ignore folders during autoloading via config('ddd.autoload_ignore'), or register a custom filter callback via DDD::filterAutoloadPathsUsing(callable $filter).
    /*
    |--------------------------------------------------------------------------
    | Autoload Ignore Folders
    |--------------------------------------------------------------------------
    |
    | Folders that should be skipped during autoloading discovery,
    | relative to the root of each domain.
    |
    | e.g., src/Domain/Invoicing/<folder-to-ignore>
    |
    | If more advanced filtering is needed, a callback can be registered
    | using `DDD::filterAutoloadPathsUsing(callback $filter)` in
    | the AppServiceProvider's boot method.
    |
    */
    'autoload_ignore' => [
        'Tests',
        'Database/Migrations',
    ],

Changed

  • Internals: Domain cache is no longer quietly cleared on laravel's cache:clearing event, so that ddd:cache yields consistent results no matter which order it runs in production (before or after cache:clear or optimize:clear commands).

What's Changed

Full Changelog: v1.1.0...v1.1.1

v1.1.0

07 Apr 17:01
0897d40
Compare
Choose a tag to compare

[1.1.0] - 2024-04-07

Added

  • Add ddd:class generator extending Laravel's make:class (Laravel 11 only).
  • Add ddd:interface generator extending Laravel's make:interface (Laravel 11 only).
  • Add ddd:trait generator extending Laravel's make:trait (Laravel 11 only).
  • Allow overriding configured namespaces at runtime by specifying an absolute name starting with /:
# The usual: generate a provider in the configured provider namespace
php artisan ddd:provider Invoicing:InvoiceServiceProvider 
# -> Domain\Invoicing\Providers\InvoiceServiceProvider

# Override the configured namespace at runtime
php artisan ddd:provider Invoicing:/InvoiceServiceProvider
# -> Domain\Invoicing\InvoiceServiceProvider

# Generate an event inside the Models namespace (hypothetical)
php artisan ddd:event Invoicing:/Models/EventDoesNotBelongHere
# -> Domain\Invoicing\Models\EventDoesNotBelongHere

# Deep nesting is supported
php artisan ddd:exception Invoicing:/Models/Exceptions/InvoiceNotFoundException
# -> Domain\Invoicing\Models\Exceptions\InvoiceNotFoundException

Fixed

  • Internals: Handle a variety of additional edge cases when generating base models and base view models.

What's Changed

Full Changelog: v1.0.0...v1.1.0

v1.0.0

31 Mar 01:08
13112ac
Compare
Choose a tag to compare

v1 Highlights 🚀

Updated command syntax, 16 new generator commands, and support for autoloading and auto-discovery (domain service providers, commands, policies, factories). Minimum supported Laravel version is now 10.25.

Upgrading from 0.x

Things to be aware of when upgrading from 0.x:

  • If the config file was published, it should be removed, re-published, and re-configured according to the latest format. A helper command ddd:upgrade is available to assist with this.
  • If stubs were published, they should also be re-published and inspected to ensure everything is up-to-date.
  • In production, ddd:cache should be run during the deployment process to optimize autoloading. See the Autoloading in Production section for more details.

Full change details below.

[1.0.0] - 2024-03-31

Added

  • ddd:list to show a summary of current domains in the domain folder.
  • For all generator commands, if a domain isn't specified, prompt for it with auto-completion suggestions based on the contents of the root domain folder.
  • Command aliases for some generators:
    • Data Transfer Object: ddd:dto, ddd:data, ddd:data-transfer-object, ddd:datatransferobject
    • Value Object: ddd:value, ddd:valueobject, ddd:value-object
    • View Model: ddd:view-model, ddd:viewmodel
  • Additional generators that extend Laravel's generators and funnel the generated objects into the domain layer:
    • ddd:cast {domain}:{name}
    • ddd:channel {domain}:{name}
    • ddd:command {domain}:{name}
    • ddd:enum {domain}:{name} (Laravel 11 only)
    • ddd:event {domain}:{name}
    • ddd:exception {domain}:{name}
    • ddd:job {domain}:{name}
    • ddd:listener {domain}:{name}
    • ddd:mail {domain}:{name}
    • ddd:notification {domain}:{name}
    • ddd:observer {domain}:{name}
    • ddd:policy {domain}:{name}
    • ddd:provider {domain}:{name}
    • ddd:resource {domain}:{name}
    • ddd:rule {domain}:{name}
    • ddd:scope {domain}:{name}
  • Support for autoloading and discovery of domain service providers, commands, policies, and factories. (co-authored by @pelmered)

Changed

  • (BREAKING) For applications that published the config prior to this release, config should be removed, re-published, and re-configured.
  • (BREAKING) Generator commands no longer receive a domain argument. Instead of ddd:action Invoicing CreateInvoice, one of the following would be used:
    • Using the --domain option: ddd:action CreateInvoice --domain=Invoicing (this takes precedence).
    • Shorthand syntax: ddd:action Invoicing:CreateInvoice.
    • Or simply ddd:action CreateInvoice to be prompted for the domain afterwards.
  • Improved the reliability of generating base view models when ddd.base_view_model is something other than the default Domain\Shared\ViewModels\ViewModel.
  • Domain factories are now generated inside the domain layer under the configured factory namespace ddd.namespaces.factory (default Database\Factories). Factories located in /database/factories/<domain>/* (v0.x) will continue to work as a fallback when attempting to resolve a domain model's factory.
  • Minimum supported Laravel version is now 10.25.

Chore

  • Dropped Laravel 9 support.

What's Changed

New Contributors

Full Changelog: v0.10.0...v1.0.0

v0.10.0

23 Mar 21:02
bce9ab5
Compare
Choose a tag to compare

[0.10.0] - 2024-03-23

Added

  • Add ddd.domain_path and ddd.domain_namespace to config, to specify the path to the domain layer and root domain namespace more explicitly (replaces the previous ddd.paths.domains config).
  • Implement Lunarstorm\LaravelDDD\Factories\HasDomainFactory trait which can be used on domain models that are unable to extend the base domain model.

Changed

  • Default base-model.php.stub now utilizes the HasDomainFactory trait.

Deprecated

  • Config ddd.paths.domains deprecated in favour of ddd.domain_path and ddd.domain_namespace. Existing config files published prior to this release should remove ddd.paths.domains and add ddd.domain_path and ddd.domain_namespace accordingly.
    /*
    |--------------------------------------------------------------------------
    | Domain Path
    |--------------------------------------------------------------------------
    |
    | The path to the domain folder relative to the application root.
    |
    */
    'domain_path' => 'src/Domain',

    /*
    |--------------------------------------------------------------------------
    | Domain Namespace
    |--------------------------------------------------------------------------
    |
    | The root domain namespace.
    |
    */
    'domain_namespace' => 'Domain',

    // Deprecated:
    // 'paths' => [
    //     //
    //     // Path to the Domain layer.
    //     //
    //     'domains' => 'src/Domain',
    // ],

What's Changed

  • Refactor domain path and namespace configuration. by @JasperTey in #43
  • HasDomainFactory trait implementation. by @JasperTey in #44

Full Changelog: v0.9.0...v0.10.0