Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Dto Laravel Package

open-southeners/laravel-dto

View on GitHub
Deep Wiki
Context7
3.8.0

Added

  • Laravel 13 support
3.7.0

Added

  • Laravel 12 support

Removed

  • PHP 8.1 support
  • Laravel 9 and 10 support
3.6.0

Added

  • Command make:dto now opens the file after is generated

Changed

  • extended-php dependency replaced with extended-laravel (required to use OpensGeneratedFiles trait on the make:dto command)
3.5.4

Changed

  • New dependency name replaced laravel-helpers with extended-php
3.5.3

Fixed

  • Filtering reset keys to numeric when string needed
3.5.2

Fixed

  • Filtering on collections with not null data
3.5.1

Fixed

  • Filtering on collections with not null data
3.5.0

Added

  • Improve model morph mapping sending multiple IDs and their matches types. Documentation link
3.4.0

Added

  • DataTransferObjects now have dump and dd methods

Fixed

  • toArray method not returning everything when DTOs where used on the request and later on reused. Caveat: Only one DTO per request until v4 refactor
3.3.0

Added

  • Laravel 11 support
  • Collected data transfer objects now mapped properly using fromArray
3.2.3

Fixed

  • From request context with DTO's filled method not working properly
3.2.2

Fixed

  • Route resolution on the model's logic (resolveRouteBindingQuery)
3.2.1

Fixed

  • Route binding when nested DTO is being used with same parameter key as route binding
3.2.0

Changed

  • Models route binding now uses Eloquent's Model resolveRouteBindingQuery method
  • Models uses default routing key (getRouteKeyName) only when BindModel PHP attribute doesn't have the using argument

Fixed

  • Routes binding models through DTOs now are injected back to route parameters (to be reused in every other part of the software)
3.1.3

Fixed

  • BackedEnum typed properties with union types falling back to original value
3.1.2

Fixed

  • laravel-helpers package version constraints so it doesn't conflict with any other package that uses it in the same way (or even the root project)
3.1.1

Fixed

  • Serialisation using old BindModelUsing instead of new BindModel attribute
3.1.0

Added

  • JSON strings to collections (arrays or Illuminate's Collection instances)
3.0.3

Fixed

  • Regression introduced by morphs fix using abstract Model class
3.0.2

Fixed

  • Morph binding using generic Illuminate's model class (not instantiable), fallbacks to Relation::morphMap
3.0.1

Fixed

  • Passing through with no type casting already matching typed properties (enums, objects, etc...)
2.2.1

Fixed

  • Enums parsing when one is being passed to DTOs (thanks @coclav 🎉) [#6]
3.0.0

Added

  • Morph support for data transfer objects model properties and collection properties. For e.g: public Film|Post $taggable, public string $taggableType
  • Simplificated OpenSoutheners\LaravelDto\Attributes\BindModel attribute grouping all the model binding options.
  • Support for 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

Changed

  • Replace all #[BindModelUsing('attribute')] to #[BindModel(using: 'attribute')] in your code (take in mind it must not be repeated under the same property)
  • Replace all #[BindModelWith(['relation1', 'relation2'])] to #[BindModel(with: ['relation1', 'relation2'])] in your code (take in mind it must not be repeated under the same property)
2.2.0

Added

  • OpenSoutheners\LaravelDto\Attributes\WithDefaultValue attribute to set default value
  • #[WithDefaultValue(Authenticatable::class)] will set as default value the authenticated user (Auth::user())
2.1.1

Fixed

  • Now \stdClass properties get properly serialised as multidimensional arrays
2.1.0

Added

  • TypeScript .d.ts generation command with --declarations option

Changed

  • Default TypeScript types generation command options now have some of them on the config file

Fixed

  • Config file now is exposed to be published using vendor:publish --provider="OpenSoutheners\\LaravelDto\\ServiceProvider" or vendor:publish --tag="config" commands
  • Non typed properties when nullable or not while TypeScript types generation
2.0.1

Fixed

  • Keys normalisation on types generator (snake case when enabled from config)
  • Types generator when empty collections
2.0.0

Added

  • Serialisation for DTO objects so now they can be sent to queued jobs
  • dto:typescript command for generating TypeScript types based on your application's DTOs
1.10.11

Fixed

  • Sending multiple values (for e.g. 1,2,5) on a collection with BindModelUsing attribute or custom model's getRouteKeyName method now works querying all models
  • make:dto command now does not generate a ValidatedDataTransferObject with request static method on it
1.10.10

Fixed

  • Request option for make:dto command when sent without a value fails
1.10.9

Fixed

  • make:dto with _id ending properties
1.10.8

Fixed

  • Fix make:dto command when validated form request sent with properties that has children items like array.*.item
1.10.7

Fixed

  • DataTransferObject::toArray when DTO constructed fromArray is getting request stuff, it doesn't get all properties
1.10.6

Fixed

  • make:dto with request option doesn’t add class string to static method
1.10.5

Fixed

  • make:dto command with validated requests sent to option
1.10.4

Fixed

  • Validation not applied for ValidatedDataTransferObject interface DTOs
1.10.3

Changed

  • ValidatedDataTransferObject 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)
1.10.2

Changed

  • Better error reporting when DTO class is being bound to a controller
1.10.1

Fixed

  • Collections does not get mapped when Illuminate's collection has been sent to DTO
1.10.0

Changed

  • Model binding defaults to primary key instead of Model::getRouteKeyName() (which should be used for those coming from routes instead)
  • Route bound models are using specified attributes instead of default to IDs (model's primary keys). For e.g. posts/{post:slug} will use slug on the DTO query

Fixed

  • BindModelUsing now uses the attribute on the binding query
1.9.0

Added

  • OpenSoutheners\LaravelDto\Attributes\BindModelUsing property PHP attribute class for use attribute to do the binding/serialisation
1.8.3

Fixed

  • Issue mapping custom objects from data collections (native arrays or Illuminate's collections)
1.8.2

Added

  • make:dto --request command now accepts empty request option to create empty base DTO class with empty request method

Fixed

  • make:dto --request now fill request method properly
1.8.1

Fixed

  • Collections binding models were returning model instance instead of array or Illuminate\Support\Collection with the models inside
  • DataTransferObject::filled() method now checks within route parameters as well as sent request body data if is within request context
  • DataTransferObject::toArray() method now returns arrays with nested toArray calls when collections or models
1.8.0

Added

  • php artisan make:dto --request='App\Http\Requests\PostCreateFormRequest' PostCreateData will now fill the request part and all properties for you with their types (experimental)
  • Map arrays or json strings into generic objects (\stdClass) or custom objects (using their classes)
  • Map string dates into Illuminate\Support\Carbon or Carbon\Carbon or Carbon\CarbonImmutable instances
1.7.1

Fixed

  • Laravel collections not being mapped properly
  • Arrays not mapping properly when not containing strings (arrays with arrays inside)
1.7.0

Added

  • Command option --request to create ValidatedDataTransferObject with request method in it.
1.6.0

Added

  • Add binding resolution so DataTransferObjects can act as validated requests using ValidatedDataTransferObject interface
  • Add authenticated user “automagical” binding to DataTransferObject property when possible (need to be typed as Authenticatable illuminate's contract)

Changed

  • Now route parameters are merged into DataTransferObjects when running within requests context
1.5.1

Fixed

  • Minor issue, now doesn't query when sending model instance using DataTransferObject::fromArray() method
1.5.0

Changed

  • Properties returned from toArray are now snake cased (from myPropertyName to my_property_name)
  • Improved toArray to return just some modified properties (from defaults)
1.4.1

Added

  • toArray method to DTOs

Fixed

  • BindModelWith attribute on collection typed properties
1.4.0

Added

  • Introducing mapped types using docblock [@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> $models
  • Optional normalisation option for properties names (workspace_id to workspace, post_tags to postTags, etc) to package config file (publish using command php artisan vendor:publish --provider="OpenSoutheners\LaravelDto\ServiceProvider")
  • Attribute OpenSoutheners\LaravelDto\Attributes\NormaliseProperties to use in some DTO classes that needs properties normalisation (when globally disabled from config)
  • Attribute OpenSoutheners\LaravelDto\Attributes\BindModelWith to bind to model with relationships included

Changed

  • Now using symfony/property-info for better property assertion (so many bugs and inconsistencies on promoted properties in PHP8+ assertions)
1.3.1

Changed

  • DataTransferObject::fromArray now uses initialize method instead of withDefaults (internal change, shouldn't affect anything)
1.3.0

Changed

  • DataTransferObject::filled method refactored with better logic
1.2.0

Added

  • DataTransferObject::fromRequest() method shortcut (does same as DataTransferObject::fromArray($request->validated()) or DataTransferObject::fromArray($request->all()))
1.1.0

Added

  • make:dto command to generate data transfer object classes
1.0.0

Added

  • Initial release!
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver