Creating a Laravel specific package
John Braun wrote a good series on how to get started with Laravel package development
Read more [johnbraun.blog]
John Braun wrote a good series on how to get started with Laravel package development
Read more [johnbraun.blog]
? Don't use magic numbers when defining any TTL (like cache or cookies) in PHP. Use human-readable intervals instead. pic.twitter.com/ZC6S6BVMUi
— Marcel Pociot ? (@marcelpociot) September 23, 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."
Stefan Zweifel shared his GitHub action that can automatically fix code style issues using prettier and php-cs-fixer
One workflow is really like, is to run prettier and php-cs-fixer to automatically format my code and commit the fixed files back to the repository.
Read more [stefanzweifel.io]
My buddy Mattias explains how you can use Laravel and Caddy to handle https traffic to dynamic subdomains.
We recently launched our new Status Page feature. Under the hood, it's using the Caddy proxy server and Laravel's subdomain routing to serve the right status page on the right domain. With this technology stack, we can automatically generate, configure & renewe the SSL certificates for custom domains of our clients.
Read more [ohdear.app]
? In many cases avoiding `else` and using early returns will greatly improve readability of your code.
— Freek Van der Herten (@freekmurze) 17 september 2019
I wish somebody would have told me this sooner in my career.
Contrived example in the image. Real world example: https://t.co/oOsSGAJLZm#bestpractices pic.twitter.com/YgqB0kMIpg
Read more [twitter.com]
In this old, but still relevant, blog post Craig Davis explains what guard clauses are and how they can be used to clean up your code.
We’ll first explore several versions of a sample method from a hypothetical billing system. For these purposes, we’ll assume this is code in an existing system and we’ll look at refactoring it to reduce complexity and make it easier for a programmer to understand. The first example will be trivial enough to easily understand, but we’ll build on it in the final examples.
Read more [engineering.helpscout.com]
Roberto B wrote a good tutorial on how to test your Laravel 6 application using GitHub actions.
The scenario that I would like to explain you is: I have a Web App based on Laravel 6, every time I push some new code on master branch on the GitHub repository, I would like to execute automatically Unit tests and Feature tests.
Read more [medium.com]
I'm currently organizing the Full Stack Europe conference. The first edition will be on 23 - 25 October in the beautiful city of Antwerp, Belgium. I believe that the best apps or sites aren't built by programmers. They're built by teams. That's why we designed this conference for everybody and don't stick to just one aspect of programming.
Tony Messias wrote a good post on the Madewithlove blog on how to get started using Elastichsearch in a Laravel app.
One of the most popular ways is using Elasticsearch. It is a very powerful tool and it comes with a variety of useful features and complementary tools. We are going to cover the basics here and leave you with some links for more resources if you want to dig further.
Read more [madewithlove.be]
Today at Laracon EU, Marcel Pociot and I unveiled Ignition, a beautiful new error page for Laravel. It is the new default error screen in Laravel 6 and you can manually install it into Laravel 5 applications. In this blog post, I'd like to tell you all about it.
? If you need to process a lot of models, don't load them all into memory, but chunk them.
— Freek Van der Herten ? (@freekmurze) August 21, 2019
Laravel has a beautiful `each` method for this.https://t.co/cVWdpsGtQ1#laravel #php pic.twitter.com/ISW7XQcehx
Read more [twitter.com]
Stefan Bauer explains how to handle error message when you have multiple forms on one page
Here's another tip! Even if it's documented here I just wanted to show it. Here's the deal: Imagine you have multiple forms one page. For example one contact form and another newsletter signup form. Both of them might have an email field. So who do you know which email field doesn't validate and throws an error?
Read more [stefanbauer.me]
☝️If you are relatively new to Testing in Laravel. Here are 3 methods you NEED to be familiar with.
— Caleb Porzio (@calebporzio) August 21, 2019
Understanding these will make your life much easier. pic.twitter.com/x3mxjCsV9z
Read more [twitter.com]
I just found out that a recent version of #Laravel Valet introduced a "valet use php@version" command. Make sure you upgrade Valet to get this functionality. ? pic.twitter.com/JW99xfJNNb
— Kevin McKee (@iAmKevinMcKee) August 12, 2019
Read more [twitter.com]
Unsung Laravel hero Joseph Silber opened up a very interesting PR to Laravel. Let's hope this one gets accepted.
Whereas the existing Collection class wraps a native array, the new LazyCollection class wraps a native iterator, while still providing most of the methods that we know and love from a regular collection.
Read more [github.com]
Christoph Rumpel wrote a clear post on how you can use Laravel's service container.
The service container is a quite complex topic, and I see many struggling to understand what it does. It was the same for me, and the main reason is that many explanations concentrate on "how" to use the container. With this article, I want to give you my introduction to this topic by focusing on the "why" and "when" the container can help us with our dependencies.
Read more [christoph-rumpel.com]
Patrick Brouwers, the creator of Laravel Excel, explains how to handle failing jobs in Laravel
When designing software, don’t only think about the happy path. Write down (preferably with (unit) tests) what all the things are that could go wrong. Then design your solution to be able to recover those situations. (Wether or not automatic.) There isn’t a single solution to rule them all, some processes might need to have specific failure handling while others are fine with the default approach.
Read more [medium.com]
Jonathan Reinink has added a very usefull metric to Laravel debugbar
Last week at Laracon US I gave a talk titled Eloquent Performance Patterns. In that talk I used a custom Laravel Debugbar metric I created to track how many Eloquent models were being hydrated throughout a request. I've had a lot of people asking about this, so today I submitted a pull request to the Laravel Debugbar to add this as an official metric.
Read more [reinink.ca]
Scary stuff.
US BlackHat 2018 proved that is possible to obtain RCE from a PHAR package, moreover, by tweaking its binary content, it's possible to disguise it as a full valid image, bypassing security checks.
Read more [www.nc-lp.com]
? In @laravelphp you can customize validation error messages in a form request ? pic.twitter.com/8XFUeuqFOT
— Freek Van der Herten ? (@freekmurze) July 10, 2019
Read more [twitter.com]