Forget about component lifecycles and start thinking in effects

Link – sebastiandedeyne.com

In a new blogpost, my colleague Seb explains why you should and how you can use useEffect.

React recently introduced a new way to deal with side effects: the useEffect hook. Translating lifecycle methods to useEffect calls can be confusing at first. It’s confusing because we shouldn’t be translating imperative lifecycle methods to declarative useEffect calls in the first place.

Read more [sebastiandedeyne.com]

Stay up to date with all things Laravel, PHP, and JavaScript.

Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Laravel Blade Helpers

Link – liamhammett.com

Liam Hammett created a cool package to easily create Blade Helpers in Laravel.

I put together a package that attempts to help make these helper functions that little bit easier to define without the boilerplate of returning the string or having to consider what an expression may be when creating a Blade directive.

Read more [liamhammett.com]

Vue's Darkest Day

Link – dev.to

Daniel Elkington comments on the reactions to an important RFC that adds function-based components to Vue.

Today I was amazed to see the usually positive and friendly VueJS community descend into a bitter war. Two weeks ago Vue creator Evan You released a Request for Comment (RFC) for a new function-based way of writing Vue components in the upcoming Vue 3.0. Today a critical Reddit thread followed by similarly critical comments in a Hacker News thread caused a flood of developers to flock to the original RFC to voice their outrage, some of which were borderline abusive

Read more [dev.to]

A Look At PHP’s isset()

Link – medium.com

Liam Hammet wrote a good blogpost on the isset language construct.

Let’s take a look through how isset behaves and what’s so special about it. Even if you’re a veteran PHP developer, hopefully, you’ll pick up something new here.

Read more [medium.com]

Sending and receiving webhooks in Laravel apps

Original – by Freek Van der Herten – 8 minute read

A webhook is a mechanism where an application can notify an other application that something has happened. Technically, the application sends an HTTP request to that other application. In this blog post, I'd like to introduce you to two packages that we recently released. The first is laravel-webhook-server, which allows you to send webhook requests. The second one is laravel-webhook-client, which makes it easy to receive those webhook request.

Read more

Timelapse of the future

Link –

An amazing video on the fate of our universe.

To me, this overhead view of time gives a profound perspective - that we are living inside the hot flash of the Big Bang, the perfect moment to soak in the sights and sounds of a universe in its glory days, before it all fades away. Although the end will eventually come, we have a practical infinity of time to play with if we play our cards right. The future may look bleak, but we have enormous potential as a species.

Read more

Typed properties in PHP

Link – stitcher.io

Brent wrote another nice post on PHP. This time on the upcoming typed hints feature of PHP 7.4.

Typed class properties were added in PHP 7.4 and provide a major improvement to PHP's type system. These changes are fully opt-in and backwards compatible. In this post we'll look at the feature in-depth.

Read more [stitcher.io]

A package to control the flow of time

Original – by Freek Van der Herten – 2 minute read

Imagine you're building that your app can notify your user, but you don't want to send more than one notification in a timeframe of five seconds. How are you going to test the time aspect? Do you have to create a test that takes five minutes?

Read more

Your first performance budget with Lighthouse

Link – bitsofco.de

Ire Aderinokun, Front-End Developer and User Interface Designer, explains how you can Lighthouse in CI.

Until recently, I also hadn't setup an official performance budget and enforced it. This isn’t to say that I never did performance audits. I frequently use tools like PageSpeed Insights and take the feedback to make improvements. But what I had never done was set a list of metrics that I needed the site to meet, and enforce them using some automated tool.

Read more [bitsofco.de]

Learning Laravel - Observations, part 1: The service container

Link – matthiasnoback.nl

Matthias Noback wrote down some thoughts on the Laravel container

Laravel's service container looks great. I like the idea that it can figure things out mostly by itself. I like that it's PHP-based, and that its syntax is quite compact. I think that most of the convenience functions (e.g. resolve()) and exotic options (like $this->app->resolving()) should be ignored. The best thing you can do for your application in the long term is to let all your services use dependency injection, and to inject only constructor arguments. This keeps things simple, but also portable to other frameworks with other dependency injection containers, or other architectural styles, when the time is there.

Read more [matthiasnoback.nl]

Tests and types

Link – stitcher.io

My colleague Brent wrote another excellent blog post, this time on tests and types.

So while strong types can help us to ensure program correctness, some tests will always be a necessity to ensure business correctness. It's a matter of "both and", not "either or".

Read more [stitcher.io]

Refactoring to actions

Original – by Freek Van der Herten – 6 minute read

In our recent projects at Spatie, we've started using a concept called "actions". It keeps our controllers and models skinny. It's a straightforward practice. In this blog post, I'd like to explain it to you.

Read more

Internal classes in PHP

Link – nunomaduro.com

Nuno Maduro, engineer at Algolia, explains what is the value of the @internal tag

The PHP @internal tag can be used to denote that the associated class/method is internal to the library. It's supported by PHPStorm and it warns people that those classes/methods are not meant to be used

Read more [nunomaduro.com]