Upgrade to Pro — share decks privately, control downloads, hide ads and more …

I shall define this only once

I shall define this only once

Freek Van der Herten

September 14, 2022

More Decks by Freek Van der Herten

Other Decks in Programming


  1. I shall say define this only once

  2. About me Freek Van der Herten Developer at SPATIE @freekmurze

    freek.dev mailcoach.app ohdear.app fl areapp.io
  3. Open source ± 300 packages on Packagist ± 360 000

    000 downloads total ± 20 000 000 downloads a month
  4. spatie.be/open-source

  5. spatie.be/open-source/postcards

  6. Let’s talk about Laravel Data

  7. At Spatie Big projects Complex data, lots of properties and

    relations A lot data structures de fi ned multiple times for di ff erent purposes Form requests, API resources, TypeScript de fi nitions
  8. Laravel Data An easy to use Laravel package Create powerful

    data objects A single de fi nition that can be used for multiple purposes Created by Ruben Van Assche 250K downloads
  9. This talk A simple example Real world usage in Flare

  10. Let’s code

  11. In closing

  12. Laravel Data Rich data objects De fi ne a data

    structure only once Can replace API resources, Form Requests, … Generating TypeScript de fi nitions
  13. Laravel Data Optional properties Lazy loading of properties Create data

    from incoming requests, JSON and objects In fi nitely con fi gurable … and a whole lot more
  14. spatie.be/docs/laravel-data

  15. Laravel Data For everything For only small parts Don’t just

    discard the Laravel defaults Do what is best for your team and project
  16. One more thing

  17. Laracon Promo 20% discount on all spatie products, no coupon

    needed spatie.be/products Products: Ray, Mailcoach, Laravel Comments, MediaLibrary Pro Courses: Testing Laravel, Laravel Package Training, Laravel Beyond Crud, Writing Readable Laravel, Laravel Event Sourcing
  18. Thank you! freek.dev mailcoach.app spatie.be ohdear.app fl areapp.io