Eloquent's `is()` method
?? Use Eloquent's "->is()" method for more expressive and thorough assertions pic.twitter.com/8zx8AEm9Rw
— Caleb Porzio (@calebporzio) 22 juni 2018
Read more [twitter.com]
?? Use Eloquent's "->is()" method for more expressive and thorough assertions pic.twitter.com/8zx8AEm9Rw
— Caleb Porzio (@calebporzio) 22 juni 2018
Read more [twitter.com]
Recently I was working on a client project where a data import was performed via queues. Each record was imported in its own queued job using multiple queue workers. After the data import was done we had more rows than expected in the database. In this blogpost I'd like to explain why that happened.…
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 publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
Mattias Noback shares how you can migrate a code base that fetches its dependencies using static method calls to code that uses dependency injection.
I've worked with several code bases that were littered with calls to
Zend_Registry::get(),sfContext::getInstance(), etc. to fetch a dependency when needed. I'm a little afraid to mention façades here, but they also belong in this list. The point of this article is not to bash a certain framework (they are all lovely), but to show how to get rid of these "centralized dependency managers" when you need to.
Read more [matthiasnoback.nl]
Joe Watkins, core PHP developer and author of (amongst many other things) ptrheads, is busy creating a PHP debugger written in PHP that you can just composer require.
This isn't just pipe dreams, the PHP code exists, it's alpha quality and largely untested ...There is much to do and you shouldn't design your workflow around this (or any alpha quality software) yet. What you should do is start reading code, testing, and opening pull requests...
You'll find the code of Joe's debugger in this repo on GitHub.
Read more [blog.krakjoe.ninja]
?♂️So you think that code always flows through either the if or else branch in a PHP script?
— Freek Van der Herten (@freekmurze) June 13, 2018
Hold my ?
----
<?php$pid = pcntl_fork();
if ($pid) {
echo 'in if';
}
else {
echo 'in else';
}
----
Try it out!#processcontrol #fun
Read more [twitter.com]
Nick Sherman created a cool site where you can play with variable fonts.
This site’s goal is to help designers and developers become more familiar with OpenType variable fonts in a way that isn’t overwhelming, while also providing straightforward info upfront about the font projects, who made them, and where to find more info or get the fonts to use.
Read more [v-fonts.com]
On his blog [Hidde De Vries] recaps a talk by Sir Tim Berners-Lee, the inventor of the web, on redecentralising the web.
However, if we’re not careful, Berners-Lee warned, there can also be a vicious circle, a dystopian scenario. This happens when algorithms cause people to meet more people like themselves, narrows down their circle and alienates them from people who are different. Or when websites are used to harvest people’s personal data that are then used for political gain.
Read more [hiddedevries.nl]
Bram Van Damme, who runs the excellent bram.us blog recently gave a talk at the Frontend United 2018 conference on what will be coming to JavaScript in the next few years.
With ES2015 a lot has changed in JavaScript-land. Lesser known releases are the ES2016 and ES2017 releases. This talk not only touches these two new releases, but also looks forward at what’s to come next for JavaScript (ES2018 and more).
You'll find the videos of the other talks at Frontend United in this playlist on YouTube.
A GitHub repo containing easy to understand PHP snippets.
Read more [github.com]
? Super simple clean-up, but the cause of so much "dead code". When using `return` statements within a `switch` block the `break` is unnecessary and is always unnecessary for the `default` case. pic.twitter.com/QxjFmiGcYy
— Jason McCreary (@gonedark) June 11, 2018
Read more [twitter.com]
My colleague Brent gave his first public talk at last month's Full Stack Antwerp meetup. If you weren't able to attend you'll be happy to learn to Brent made a YouTube video with the content of his talk.
My buddy Frederick Vanbrabant, who is currently looking for a new opportunity, recorded a cool video course on how to build a PHP framework using some popular components. Here's the playlist that contains all the episodes.
Marina Posniak, UX writer at Spotify, shares some great tips on how to write error messages well.
To start, ask yourself if you even need the error message. Before writing anything, consider if there’s a way to redesign the experience so there’s no error at all. Is there a way to just make it work? (Really, the best error message is no error message.) But if you do need it, think carefully about the message. When things go wrong and the app “fails,” say something useful. The message should help the user solve the problem and move on.
Read more [thestyleofelements.org]
Recently Taylor Otwell held a blogging competition. Entries could be submitted on a GitHub repo, the post with the highest amount of ? would win. My colleague Alex wrote a blogpost on how you could easily win the competition by hacking a bit. It's pretty awesome that Alex, without using any of the hacks described in the post, wound up winning the competition.
I feel like programmers are often as good at breaking things as they are at fixing things. Part of the thought process of programming anything new is figuring out its flaws, weaknesses and possible exploitations. As a web developer, I often find myself applying the same thought process to everything I see and read about online. Including Laravel's May Mayhem blog contest.
Read more [alexvanderbist.com]
A few weeks ago Matthieu Napoli released Bref, a tool to get any PHP project up and running in a serverless environment. Matthieu has managed to get working serverless too.
Serverless basically means “Running apps without worrying about servers”. The main difference with a traditional hosting is that you do not maintain the servers and reserve their capacity. They are scaled up or down automatically and you pay only for what you use. ... Today let’s try to deploy a Laravel application on AWS lambda using Bref.
Read more [mnapoli.fr]
– dev.to
A great post by Barry O Sullivan on what, in my mind, is one of the biggest advantages of event sourcing: the ability to create projections.
Projections are a necessary part of any event sourced or CQRS system. These systems don't rely on a single generic data source such as a normalised MySQL database. Instead you build up your data sets by playing through the events, i.e the “film”, "projecting" them into the shape you want. This allows lot of flexibility as you're no longer bound by a single data model on which you have to run increasingly monstrous SQL queries (12+ joins anyone?). With projections you can build a data model specifically for the problem/question at hand.
Read more [dev.to]
#didyouknow that by type-hinting `offsetGet` and `current`, you can get autocompletion of custom Iterator and ArrayAccess classes in @phpstorm pic.twitter.com/Mr19b2gpye
— BrenDt (@brendt_gd) June 1, 2018
Read more [twitter.com]
Bad title because we don't do overtime at Spatie, but our team has been very busy putting out new open source stuff. In the past weeks our team has released three new packages. In this post I'd like to quickly introduce them too you. sheets First up is spatie/sheets, created by Sebastian. This…
Rémi Collin shares a cool approach on where to place code that doesn't really belong in a controller. He creates small, reusable, testable, decoratable classes, called Actions.
Using this approach can seems a lot of classes at first. And, of course the user registration is a simple example aimed to keep the reading short and clear. Real value starts to become clear once the complexity starts growing, because you know your code is in one place, and the boundaries are clearly defined.
Read more [medium.com]