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

Dashboard (phpukconference 2018)

Dashboard (phpukconference 2018)

Freek Van der Herten

January 27, 2018
Tweet

More Decks by Freek Van der Herten

Other Decks in Programming

Transcript

  1. Creating a dashboard
    using Laravel ,
    Vue and Pusher

    View Slide

  2. About me
    Freek Van der Herten
    Partner & developer at SPATIE
    @freekmurze
    https://murze.be

    View Slide

  3. About me
    phpantwerp.be
    Dries Vints
    @driesvints
    Frederick Vanbrabant
    @TheEdonian

    View Slide

  4. https://ohdearapp.com

    View Slide

  5. Since 2003
    Websites, applications and webshops
    Team
    7 developers, 1 manager
    Specialization
    Laravel development

    View Slide

  6. OPEN SOURCE SOFTWARE

    View Slide

  7. https://spatie.be/en/opensource/laravel

    View Slide

  8. Open source software
    ± 160 public repositories on GitHub
    ± 9 000 000 downloads total
    ± 1 000 000 downloads a month
    A lot of benefits: learning, writing quality documentation and
    tests, showing the quality of our work, eating our own dogfood
    https://murze.be/the-story-behind-our-open-source-efforts

    View Slide

  9. WE ❤ POSTCARDS

    View Slide

  10. Spatie

    Samberstraat 69D
    2060 Antwerp

    Belgium

    View Slide

  11. View Slide

  12. View Slide

  13. View Slide

  14. View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. View Slide

  24. View Slide

  25. View Slide

  26. View Slide

  27. View Slide

  28. https://github.com/spatie/dashboard.spatie.be

    View Slide

  29. HIGH LEVEL OVERVIEW

    View Slide

  30. The dashboard is a single HTML page
    Displayed by a full screen browser
    Without full page reload
    Each tile wil be updated by JavaScript
    Each tile has it’s own update frequency
    In short

    View Slide

  31. Technology stack
    Laravel Pusher Vue.js

    View Slide

  32. Laravel 5.6
    Render the initial page
    Fetch data from external API’s (scheduled)
    Broadcast events when new data has arrived
    Laravel

    View Slide

  33. spatie/laravel-twitter-streaming-api
    spatie/laravel-google-calendar
    spatie/last-fm-now-playing
    spatie/packagist-api
    knplabs/github-api
    Laravel

    View Slide

  34. Provides full-duplex communication channels over a single TCP
    connection
    Transporting events from server to the browser
    In realtime
    Secure
    Paid service
    Pusher

    View Slide

  35. WebSockets
    Transporting events from server to the browser
    In realtime
    Secure
    Paid service
    Pusher

    View Slide

  36. Transporting events from server to the browser
    In realtime
    Secure
    Paid service
    Pusher
    Magic

    View Slide

  37. Easy to learn JS Framework
    Each tile is a component
    Listen for incoming events with Laravel Echo
    Update the tile
    Vue.js

    View Slide

  38. View Slide

  39. DEMO

    View Slide

  40. Grid system
    The clock tile
    The Packagist tile
    The Twitter tile
    Topics

    View Slide

  41. There will be 

    some live coding
    We’ll use 

    an internet connection

    View Slide

  42. DISPLAYING ON A TV

    View Slide

  43. Raspberry Pi 2

    View Slide

  44. Raspberry Pi 2
    Powered by the USB port from the TV
    Uses Raspbian Jessie
    Boots into Chromium 56 in fullscreen mode
    Setup

    View Slide

  45. TRY IT OUT YOURSELF

    View Slide

  46. Source code
    https://github.com/spatie/dashboard.spatie.be
    Blog post
    https://murze.be/2017/06/building-realtime-dashboard-powered-
    laravel-vue-2017-edition/
    Documentation

    View Slide

  47. WRAPPING UP

    View Slide

  48. Credits
    Willem Van Bockstal
    @willemvbockstal
    Looks + grid system
    Sebastian De Deyne
    @sebdedeyne
    Scrutinising + JS wizardry

    View Slide

  49. https://github.com/tlaverdure/laravel-echo-server
    https://github.com/spatie/vue-save-state
    Moarrr packages

    View Slide

  50. Thank you!
    https://joind.in/talk/c2c10
    https://speakerdeck.com/freekmurze/dashboard-phpukconference-2018
    https://spatie.be/opensource/laravel
    https://murze.be
    https://ohdearapp.com

    View Slide

  51. QUESTIONS?

    View Slide