diff --git a/config/data.php b/config/data.php index 693f20737..6a0c70862 100644 --- a/config/data.php +++ b/config/data.php @@ -1,14 +1,14 @@ DATE_ATOM, - /* + /** * Global transformers will take complex types and transform them into simple * types. */ @@ -18,7 +18,7 @@ BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class, ], - /* + /** * Global casts will cast values into complex types when creating a data * object from simple types. */ @@ -27,7 +27,7 @@ BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class, ], - /* + /** * Rule inferrers can be configured here. They will automatically add * validation rules to properties of a data object based upon * the type of the property. @@ -54,7 +54,7 @@ Spatie\LaravelData\Normalizers\JsonNormalizer::class, ], - /* + /** * Data objects can be wrapped into a key like 'data' when used as a resource, * this key can be set globally here for all data objects. You can pass in * `null` if you want to disable wrapping. @@ -69,11 +69,14 @@ */ 'var_dumper_caster_mode' => 'development', - /* - * The package will cache the reflection of data objects to improve performance. + /** + * It is possible to skip the PHP reflection analysis of data objects + * when running in production. This will speed up the package. You + * can configure where data objects are stored and which cache + * store should be used. */ 'structure_caching' => [ - 'directories' => [app_path('data')], + 'directories' => [app_path('Data')], 'cache' => [ 'store' => env('CACHE_DRIVER', 'file'), 'prefix' => 'laravel-data', diff --git a/src/Commands/DataStructuresCacheCommand.php b/src/Commands/DataStructuresCacheCommand.php index e9f5145b5..6b5f93f3e 100644 --- a/src/Commands/DataStructuresCacheCommand.php +++ b/src/Commands/DataStructuresCacheCommand.php @@ -12,7 +12,7 @@ class DataStructuresCacheCommand extends Command { - protected $signature = 'data:cache-structures'; + protected $signature = 'data:cache-structures {--show-classes : Show the data classes cached}'; protected $description = 'Cache the internal data structures'; @@ -40,6 +40,14 @@ public function handle( $progressBar->finish(); - $this->components->info('Cached '.count($dataClasses).' data classes!'); + $this->line(PHP_EOL); + $this->line('Cached '.count($dataClasses).' data classes'); + + if ($this->option('show-classes')) { + $this->table( + ['Data Class'], + array_map(fn (string $dataClass) => [$dataClass], $dataClasses) + ); + } } }