#23 Three PHP structures, Vue 3 step-by-step, and more
Welcome to the 23rd issue of The VOLT newsletter! Here's a few things from the last couple weeks:
And we’re back! 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!
Traits, Interfaces, and Abstract Classes in PHP
When I first started learning PHP, I would sometimes get confused about the differences between Traits, Interfaces, and Abstract Classes. What were the best use cases for each of them, and when would it be appropriate to use them?
I decided to write a quick blog article about it that dives into these structures. Comparing and contrasting each of them while also highlighting a few use cases, when you might want to reach for them while developing an application.
Learn Vue 3 step-by-step
Laracasts is famously known for their incredibly knowledgable courses and breadth of quality content. Announced earlier this week, their Learn Vue 3: Step By Step course is fully complete, and the entire thing can be watched on the Laracasts site for free.
Check out the tweet below for more details.
This awesome git workflow diagram
@ChrisStaud posted this simple, but incredibly useful, git workflow diagram on Twitter recently. This might seem like common knowledge to those of us who have a good amount of experience with git, but it took me a while to really nail down even the basic concepts when I was first learning.
Visual graphics like this really help me to retain information, and it’s a great little reference to come back to if I need it!
Laravel’s tap method
Earlier this week I posted the following code example on Twitter:
This is an example that uses a built-in Laravel helper, 🔗 tap() and it caused a little bit of a stir.
To some developers, the first part of the example seems like more readable code, and I won’t fault them for that. Using tap in this example (especially with the arrow function closure) makes for a pretty long one-liner that’s messy at quick glance.
However, tap is used throughout the Laravel framework in some pretty interesting ways, and it can improve your code structure and readability when used in the appropriate setting. The beauty of it lies in the fact that the modified object is returned after using it in the function provided as the second argument.
What do you think?
A new Laravel package - Haystack
Beautifully simple but powerful database-driven job chains.
It allows you to create job chains in your Laravel application, that are stored in the database and fired off one-by-one. This means that your memory usage remains low (since the entire chain isn’t stored in-memory), and you have some pretty cool methods to use to react to different points in the chain as jobs are processed.
Now, Laravel does have job chains out of the box, but they’re pretty basic and lack a lot of the features that batched jobs have. The issue though, is that batched jobs are intended to split up larger jobs into chunked events, not run completely separate jobs.
Today I learned
This issue’s TIL comes from Andrés Santibáñez. They posted this helpful bit of Laravel knowledge on Twitter about the toggle() method, which you can use to either attach or detach a model relationship based on whether or not it’s already attached!
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.