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

Highlights from the Flare codebase (laracon AU)

Highlights from the Flare codebase (laracon AU)

Freek Van der Herten

October 31, 2019
Tweet

More Decks by Freek Van der Herten

Other Decks in Technology

Transcript

  1. View Slide

  2. About me
    Freek Van der Herten
    Partner & developer at Spatie
    @freekmurze
    freek.dev
    flareapp.io
    ohdear.app

    View Slide

  3. Open source stats
    ± 250 packages on Packagist
    ± 50,000,000 total downloads
    ± 3 000,000 downloads a month
    spatie.be/open-source/packages

    View Slide

  4. Highlights from
    the Flare codebase

    View Slide

  5. A way to structure
    a large Laravel app

    View Slide

  6. Take a look at the Flare codebase
    Not a sales talk
    Techniques you can use in your own projects
    Opinionated

    View Slide

  7. Short walkthrough of the UI
    Domains
    Inertia / React / TypeScript

    View Slide

  8. Let's take a look
    at Flare

    View Slide

  9. Using domains

    View Slide

  10. Using domains
    Term taken from DDD
    A sphere of knowledge
    Grouping code
    Larger projects

    View Slide

  11. Refactor to domains
    app/
    ├── Models/
    │ ├── User.php
    │ ├── Team.php
    │ └── Project.php
    ├── Mails/
    │ ├── Welcome.php
    │ ├── InvitedToTeam.php
    │ └── ApiKeyRegenerated.php
    └── Events/
    ├── UserDeleted.php
    └── Project.php

    View Slide

  12. Refactor to domains
    app/
    └── Domain/
    ├── Team
    └── Project

    View Slide

  13. Show me the code

    View Slide

  14. Front end

    View Slide

  15. Front end
    “I strongly believe JavaScript is a requirement for excellent user
    experiences. Not good experiences, excellent experiences.”
    —Seb

    View Slide

  16. Front end: JavaScript
    Inertia
    Built by Jonathan Reinink
    Replace Blade by React (or Vue or whatever)
    Makes server client communication seamless
    No full pages refreshes

    View Slide

  17. public function index(Team $team)
    {
    return view('team.settings', collect('team'));
    }

    View Slide

  18. public function index(Team $team)
    {
    return inertia()->render('team.settings', collect('team'));
    }

    View Slide

  19. Show me!

    View Slide

  20. In closing

    View Slide

  21. Using domains
    stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel
    freek.dev/1371-refactoring-to-actions
    freek.dev/1433-supercharging-common-controllers

    View Slide

  22. Front end
    inertiajs.com
    typescriptlang.org
    freek.dev/1391-how-to-handle-front-end-authorization-using-
    laravel-inertia-and-typescript

    View Slide

  23. Thank you!
    speakerdeck.com/freekmurze/highlights-flare-codebase
    spatie.be/open-source
    freek.dev
    flareapp.io
    ohdear.app

    View Slide