A recap of 2019 original
A year ago, I wrote a recap of 2018. Now that 2019 is coming to a close, I thought it might be fun to write a similar post on what I did this year.
A year ago, I wrote a recap of 2018. Now that 2019 is coming to a close, I thought it might be fun to write a similar post on what I did this year.
?You can mutate request data using @laravelphp 's form requests instead of doing it in the controller. By overwriting the validationData() method, you can mutate data BEFORE validation. Overwrite the validated() method to mutate AFTER validation. #Laravel #php pic.twitter.com/VAVXYAHCFC
— Neil Keena (@neilkeena) November 4, 2019
Read more [twitter.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Freek’s newsletter is one of the best ways to stay updated with the Laravel and PHP ecosystem. It consistently highlights useful packages, tools, and ideas from the community, especially the amazing work coming from Spatie. As a Laravel developer building SaaS and web platforms, I find it extremely helpful to discover practical tools and insights that improve my development workflow."
I'm a big fan of this approach and use Form Request like this quite often.
Let me show you what form requests can do for you - and how you can make use of them to write beautiful, expressive APIs.
Read more [pociot.dev]
At Spatie we currently building Mailcoach: a solution to self-host newsletters and email campaigns. It can be used a stand alone app or as a laravel package. We'll also create a video course that explains the internals of the package. We're not going to make this software open source, but sell it. We're still are deciding on our pricing model.
Julien Bourdeau, engineer at Algolia, shares his thoughts on how it should be priced.
Today, Freek announced that they're going to release the pricing model soon and opened a conversation about what it could be. It got me thinking, and unfortunately, I couldn't fit my thought in 280 characters. First, it's important to understand that MailCoach will be 2 main things: a full-fledged app and a Laravel package.
Read more [www.sigerr.org]
My buddy Mattias recently improved the performance of the Oh Dear uptime checker servers by disabling the HTTP sessions.
If you run a Laravel application purely as a headless API, you can benefit from disabling the HTTP sessions. We use this setup for our Oh Dear monitoring service, where the remote servers that check for uptime are all headless Laravel setups.
Read more [ma.ttias.be]
My team and I currently building Mailcoach, a solution to self-host newsletters and email campaigns. In Mailcoach you can create new users to use the app.
How should these new users be onboarded? The easy way out would be to send these new users a default password reset notification to those users, but that isn't a good first experience. The default auth scaffold by Laravel doesn't help us here: it only contains functionality to log in and to let users register themselves.
To onboard new users created by other users, I've created a package called laravel-welcome-notification which can send a welcome notification to new users that allows them to set an initial password.
In this blogpost I'd like to explain how you can use the package).
Jess Archer recently gave an excellent talk at Laracon AU. In a new blogpost she explains one one tips given during her talk: how to close modals in a Vue app by using the back button.
On most web apps, pressing the back button while a modal dialog is open will navigate to the previous page, rather than closing the modal. This can be very frustrating! It might not seem like a huge deal on a desktop app, but on a mobile, where a modal like this will often be full-screen, and with phones having back buttons and back gestures, I believe it's a huge user experience improvement.
Read more [jessarcher.com]
My colleague Brent solved a performance by creating a custom relation
One last solution that came to mind was to load all people, all contracts, and map them together manually. In the end that's exactly what I ended up doing, though I did it in the cleanest possible way: using custom relations.
Read more [stitcher.io]
? Did you know you can add query-constraints when eager loading relationships in Laravel?
— Stefan Zweifel (@_stefanzweifel) November 12, 2019
Perfect opportunity to improve query performance when your relationships return thousands of models.
↳ Full example: https://t.co/RsezzpkWoC pic.twitter.com/nwjC7U8Oqa
Read more [twitter.com]
In this small blog post, I'd like to give you a couple of tips to make your Artisan commands better.
At Laracon AU, Jason McCreary gave an excellen talk on how to create maintainable Laravel apps. On his blog he published a written down version of the talk.
Being the author of BaseCode and creator of Shift gives me a unique insight into writing Laravel applications. I combined 20 years of writing code with supporting over 20,000 Laravel upgrades into 10 tips for crafting maintainable Laravel applications.
Read more [jasonmccreary.me]
For a couple of projects I needed to read and write a couple of very large Excel and CSV files. I didn't find a good package that does this so I decided to create one myself. Under the hood it uses generators, so memory usage will remain low, even when working with large files.
In this blogpost I'd like to walk you through spatie/simple-excel.
A couple of days ago my colleague Brent published a blogpost on Domain Oriented Laravel. In short, he makes the case for organising your code around business concepts or features. That might sound very "heavy" or daunting, but it's actually for easy to get started with.
In this short video I explain how you can use PhpStorm to refactor your code. Make up your own mind if you need this in your projects.
Tim MacDonald shares an interesting technique.
Action scopes are...well...just query scopes really, but instead of filtering they take an action. It's just a random name I've given them to differentiate them from regular filtering based query scopes in my projects.
Read more [timacdonald.me]
When the void typehint was introduced in PHP 7.1. There was some debate about it. Some people wondered if it is beneficial to type nothing? I was one of them. Meanwhile, I changed my opinion on it. In this short post, I'd like to give you a small example where I think void shines.
Recently we released a new small package called laravel-rate-limited-job-middleware. As the name implies, this package can be used to limit how many times a job may be executed in a given amount of time.
In this short blog post, I'd like to introduce the package to you.
Mattias Geniar explains how you can use GitHub actions to run the testsuite of your Laravel app.
Last year we wrote a blogpost about our setup we use for Oh Dear! with Gitlab, and how we use their pipelines for running our CI tests. Since then, we've moved back to Github since they introduced their free private repositories. In this post I'll describe how we re-configured our CI environment using Github Actions.
Read more [ma.ttias.be]