#24 Copying r/place, using ref vs reactive in Vue, and more
Welcome to the 24th issue of The VOLT newsletter! Here's a few things from the last couple weeks:
Here’s a few things from the past couple of weeks that have caught my attention. If you want to submit any news, articles, packages, or tutorials, send me a message on Twitter!
Building r/place in PHP and JavaScript in under an hour
In case you missed it, I released a new YouTube video this week where I built the Reddit experimental site r/place in just under an hour with Laravel and Vue.
It’s longer and more high-level than some of my previous videos have been, but I hope it still provides insight into creating a complex and multi-faced interactive application like this. Some of the features used include HTML canvas elements, Laravel events, websockets, and Redis database seeding.
Using ref vs reactive in Vue 3
Vue 3 introduced two new ways of adding data attributes to components: ref and reactive. There’s been a bit of confusion surrounding which one to use when, so I decided to write up a pretty short article explaining the difference between the two, and showing examples of each being used in an appropriate setting.
Here’s the link: aschmelyun.com/blog/when-to-use-ref-vs-reactive-in-vue/
If you want a tl;dr of the above, you can narrow it down to the following:
Use ref with primitives like strings, numbers, or boolean values
Use reactive with objects
Each have their pros and cons though, so be sure to check out the article for more details!
Mailbook lets you inspect Laravel mailables
A new package was pushed out recently by @maxhoogenbosch, called Mailbook.
It lets you explore your Laravel mailables without having to actually send them out of your application. Usually you’d use something like Mailhog to capture outgoing emails during development and inspect them there, but this package lets you skip that step and check out the basic design of your emails without triggering an actual send.
Installation is pretty straightforward with Composer, and from there it’s just a matter of adding in a line to your routes/web.php file and navigating to the dashboard!
Data Transfer Objects in PHP
Gio has been consistently releasing a ton of great videos on modern, vanilla PHP. This one in particular blew me away because I’ve always heard the concept thrown around but never saw a real proper application of it.
Watching everything come together in just 13 minutes was just incredible, and I’ll definitely be using DTOs in some future projects and applications. I highly recommend checking out a few other videos in his “Learn PHP the right way” series on YouTube for more helpful info like this.
Today I learned
This issue’s TIL comes from something I discovered when working with a legacy PHP application. I knew that you could use the double dollar sign to get a variable value based on another variable’s value. But, I had no idea that they stacked.
You could keep this going forever, if you wanted to!
That’s it for now! If you have any questions about the above, or have something you’d like me to check out, please feel free to let me know on Twitter.