Download the PHP package pepperfm/ssd-for-laravel without Composer
On this page you can find all versions of the php package pepperfm/ssd-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pepperfm/ssd-for-laravel
More information about pepperfm/ssd-for-laravel
Files in pepperfm/ssd-for-laravel
Package ssd-for-laravel
Short Description Simple Slim DTO
License MIT
Homepage https://github.com/pepperfm/ssd-for-laravel
Informations about the package ssd-for-laravel
Simple Slim DTO
Simple Slim DTO helps you describe small DTO classes for Laravel responses, array payloads, and typed data wrappers.
The package maps array-like input into public typed properties, supports snake_case and camelCase keys, casts nested DTOs, converts iterable items, and serializes DTOs back to arrays or JSON.
[!TIP] Full Package Description
Requirements
- PHP
^8.4
Installation
Basic Usage
Extend BaseDto and describe the payload with public typed properties.
Create DTOs from arrays, objects, Arrayable, Traversable, or named arguments.
Nested DTO properties are cast automatically.
Iterable Casting
Use ToIterable when a property contains a list of items.
The first argument is the collection type. Use ToIterable::ARRAY for a native array.
The second argument is optional and defines the item type.
For Laravel collections, pass the collection class as the first argument.
If the item type is omitted, iterable items are kept as-is.
The item type may be another BaseDto class or any class that can be instantiated from one value.
Key Mapping
Input keys can be camelCase or snake_case. Output keys are camelCase by default.
Use MapName when the external key must be explicit.
Collections and Helpers
Convert many payloads into DTO instances with collect().
Use only() and except() on serialized DTO output.
Serialization
Testing
Changelog
Please see CHANGELOG for more information about what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.