From 6bc1171930d1bba19966e3dc0f02a4a47664f3df Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Wed, 17 Apr 2024 08:42:54 -0400 Subject: [PATCH] Clean up documentation and release 1.1.1. --- CHANGELOG.md | 27 ++++++++++++++++++++++++--- README.md | 10 +++++----- UPGRADING.md | 11 +++++++++++ 3 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 UPGRADING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b49a40b..60eb300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,33 @@ All notable changes to `laravel-ddd` will be documented in this file. -## [Unversioned] +## [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)`. +- Ability to ignore folders during autoloading via `config('ddd.autoload_ignore')`, or register a custom filter callback via `DDD::filterAutoloadPathsUsing(callable $filter)`. +```php + /* + |-------------------------------------------------------------------------- + | Autoload Ignore Folders + |-------------------------------------------------------------------------- + | + | Folders that should be skipped during autoloading discovery, + | relative to the root of each domain. + | + | e.g., src/Domain/Invoicing/ + | + | 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 -- Internal: 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). +- 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). ## [1.1.0] - 2024-04-07 ### Added diff --git a/README.md b/README.md index 13a2f1b..3870cf7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/lunarstorm/laravel-ddd/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/lunarstorm/laravel-ddd/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/lunarstorm/laravel-ddd.svg?style=flat-square)](https://packagist.org/packages/lunarstorm/laravel-ddd) -Laravel-DDD is a toolkit to support domain driven design (DDD) patterns in Laravel applications. One of the pain points when adopting DDD is the inability to use Laravel's native `make:model` artisan command to properly generate domain models, since domain models are not intended to be stored in the `App/Models/*` namespace. This package aims to fill the gaps by providing an equivalent command, `ddd:model`, plus many more. +Laravel-DDD is a toolkit to support domain driven design (DDD) in Laravel applications. One of the pain points when adopting DDD is the inability to use Laravel's native `make` commands to generate domain objects since they are typically stored outside the `App\*` namespace. This package aims to fill the gaps by providing equivalent commands such as `ddd:model`, `ddd:dto`, `ddd:view-model` and many more. ## Installation You can install the package via composer: @@ -32,10 +32,9 @@ php artisan ddd:cache 10.25.x | 1.x | 11.x | 1.x | -### Upgrading from 0.x -- Update config to the [latest format](#config-file). A helper command `ddd:upgrade` is available to assist with this. -- Remove and re-publish stubs if applicable. -- In production, `ddd:cache` should be run during the deployment process. See the [Autoloading in Production](#autoloading-in-production) section for more details. +See **[UPGRADING](UPGRADING.md)** for more details about upgrading from 0.x. + + ## Usage ### Syntax @@ -231,6 +230,7 @@ DDD::filterAutoloadPathsUsing(function (SplFileInfo $file) { } }); ``` +The filter callback is based on the Symfony's [Finder Component](https://symfony.com/doc/current/components/finder.html#custom-filtering). ### Disabling Autoloading You may disable autoloading by setting the respective autoload options to `false` in the configuration file as needed, or by commenting out the autoload configuration entirely. diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..b9177b4 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,11 @@ +# Upgrading + + ## From 0.x to 1.x +- Minimum required Laravel version is 10.25. +- The ddd generator [command syntax](README.md#usage) in 1.x. Generator commands no longer receive a domain argument. For example, 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. +- The [config file](config/ddd.php) was refactored. A helper command `ddd:upgrade` is available to assist with this, but it is strongly recommended that you simply wipe out the old config and re-publish via `php artisan vendor:publish --tag="ddd-config"` and re-configure accordingly. +- If applicable, stubs should also be re-published via `php artisan vendor:publish --tag="ddd-stubs"` and re-customized as needed. +- In production, `ddd:cache` should be run during the deployment process. See the [Autoloading in Production](README.md#autoloading-in-production) section for more details.