Releases: culturegr/presenter
Automatic Array/JSON Conversion for Presenters
This release significantly enhances the usability of the Presenter package:
- Automatic array and JSON conversion: Presenters can now be directly passed to views or returned from routes without explicitly calling
toArray()
ortoJson()
. - Array access support: Presenters implement
ArrayAccess
, allowing them to be used like arrays. - JSON serialization: Presenters now implement
JsonSerializable
for seamless JSON encoding. - Abstract
toArray()
method: Enforces proper implementation in child classes, ensuring consistent behavior. - Updated documentation: README now clearly explains the new automatic conversion features and provides usage examples.
- Expanded test coverage: New tests added for array access and JSON serialization functionality.
These improvements streamline the use of Presenters in Laravel applications, particularly for view data preparation and API responses, reducing boilerplate code and potential errors.
Important Note for Existing Users: If you're currently calling toArray()
explicitly when using Presenters (e.g., UserPresenter::make($user)->toArray()
), please note that these calls will continue to work as before. However, they are no longer necessary in most contexts due to the new automatic conversion feature. You can safely remove these explicit calls if desired, which will make your code cleaner and more concise.
These changes maintain backward compatibility while offering new, more convenient ways to use Presenters in your Laravel applications.
Support Laravel 11
- Add support for Laravel 11.x
Support Laravel 10
- Drop support for PHP 8.0
- Drop support for Laravel 8.x
- Add support for PHP 8.2 and 8.3
- Add support for Laravel 10.x
Support PHP 8.1 and Laravel 9
- Add support for PHP 8.1
- Drop support for PHP 7.x
- Add support for Laravel 9.x
- Fix a bug in
whenLoaded
method
Move tests from Codeship CI to GitHub Actions
1.0.4 Move tests from Codeship CI to GitHub Actions
Support Laravel 8
1.0.3 Support Laravel 8
Make paginator's meta information to be properly casted
Paginated collection's meta information such as current_page
, last_page
, from
, to
, total
and per_page
will be casted to integer.
Other minor changes: Add .idea
directory to .gitignore
Support Laravel 7
Update composer.json
file to support Laravel 7
Initial release
1.0.0 Initial commit