make:dto now opens the file after is generatedextended-php dependency replaced with extended-laravel (required to use OpensGeneratedFiles trait on the make:dto command)laravel-helpers with extended-phpdump and dd methodstoArray method not returning everything when DTOs where used on the request and later on reused. Caveat: Only one DTO per request until v4 refactorfromArrayfilled method not working properlyresolveRouteBindingQuery)resolveRouteBindingQuery methodgetRouteKeyName) only when BindModel PHP attribute doesn't have the using argumentBackedEnum typed properties with union types falling back to original valueBindModelUsing instead of new BindModel attributeModel classRelation::morphMappublic Film|Post $taggable, public string $taggableTypeOpenSoutheners\LaravelDto\Attributes\BindModel attribute grouping all the model binding options.OpenSoutheners\LaravelDto\Attributes\BindModel attribute in morph properties, which can be also used to customise the type key name. For e.g. from the same example from above:#[BindModel(
using: [Post::class => 'slug'],
with: [Post::class => 'tags', Film::class => ['tags', 'posts']],
morphTypeKey: 'tagType'
)]
public Film|Post $taggable,
public string $tagType
#[BindModelUsing('attribute')] to #[BindModel(using: 'attribute')] in your code (take in mind it must not be repeated under the same property)#[BindModelWith(['relation1', 'relation2'])] to #[BindModel(with: ['relation1', 'relation2'])] in your code (take in mind it must not be repeated under the same property)OpenSoutheners\LaravelDto\Attributes\WithDefaultValue attribute to set default value#[WithDefaultValue(Authenticatable::class)] will set as default value the authenticated user (Auth::user())\stdClass properties get properly serialised as multidimensional arrays.d.ts generation command with --declarations optionvendor:publish --provider="OpenSoutheners\\LaravelDto\\ServiceProvider" or vendor:publish --tag="config" commandsdto:typescript command for generating TypeScript types based on your application's DTOsBindModelUsing attribute or custom model's getRouteKeyName method now works querying all modelsmake:dto command now does not generate a ValidatedDataTransferObject with request static method on itmake:dto command when sent without a value failsmake:dto with _id ending propertiesmake:dto command when validated form request sent with properties that has children items like array.*.itemDataTransferObject::toArray when DTO constructed fromArray is getting request stuff, it doesn't get all propertiesmake:dto with request option doesn’t add class string to static methodmake:dto command with validated requests sent to optionValidatedDataTransferObject interface is no longer resolved, instead DataTransferObject class will be the one resolved (for those DTOs that doesn't have a FormRequest class on them, validated form data)Model::getRouteKeyName() (which should be used for those coming from routes instead)posts/{post:slug} will use slug on the DTO queryOpenSoutheners\LaravelDto\Attributes\BindModelUsing property PHP attribute class for use attribute to do the binding/serialisationmake:dto --request command now accepts empty request option to create empty base DTO class with empty request methodmake:dto --request now fill request method properlyIlluminate\Support\Collection with the models insideDataTransferObject::filled() method now checks within route parameters as well as sent request body data if is within request contextDataTransferObject::toArray() method now returns arrays with nested toArray calls when collections or modelsphp artisan make:dto --request='App\Http\Requests\PostCreateFormRequest' PostCreateData will now fill the request part and all properties for you with their types (experimental)\stdClass) or custom objects (using their classes)Illuminate\Support\Carbon or Carbon\Carbon or Carbon\CarbonImmutable instances--request to create ValidatedDataTransferObject with request method in it.ValidatedDataTransferObject interfaceDataTransferObject property when possible (need to be typed as Authenticatable illuminate's contract)DataTransferObject::fromArray() methodtoArray are now snake cased (from myPropertyName to my_property_name)toArray to return just some modified properties (from defaults)toArray method to DTOsBindModelWith attribute on collection typed properties[@param](https://github.com/param) type like the following: [@param](https://github.com/param) array<\App\Models\MyModel> $models or [@param](https://github.com/param) \Illuminate\Support\Collection<\App\Models\MyModel> $modelsworkspace_id to workspace, post_tags to postTags, etc) to package config file (publish using command php artisan vendor:publish --provider="OpenSoutheners\LaravelDto\ServiceProvider")OpenSoutheners\LaravelDto\Attributes\NormaliseProperties to use in some DTO classes that needs properties normalisation (when globally disabled from config)OpenSoutheners\LaravelDto\Attributes\BindModelWith to bind to model with relationships includedsymfony/property-info for better property assertion (so many bugs and inconsistencies on promoted properties in PHP8+ assertions)DataTransferObject::fromArray now uses initialize method instead of withDefaults (internal change, shouldn't affect anything)DataTransferObject::filled method refactored with better logicDataTransferObject::fromRequest() method shortcut (does same as DataTransferObject::fromArray($request->validated()) or DataTransferObject::fromArray($request->all()))make:dto command to generate data transfer object classesHow can I help you explore Laravel packages today?