PHP

★ A lightweight solution for running PHP code concurrently

[AdSense-A]

Our team released a new package called spatie/fork. Using this package you can easily execute multiple pieces of code concurrently.

In this example, where we are going to call an imaginary slow API, all three closures will run at the same time.

use SpatieForkFork;

$results = Fork::new() ->run( fn () => (new Api)->fetchData(userId: 1), fn () => (new Api)->fetchData(userId: 2), fn () => (new Api)->fetchData(userId: 3), );

$results[0]; // fetched data of user 1 $results[1]; // fetched data of user 2 $results[2]; // fetched data of user 3

If you want to know more about why we created the package, check out this blogpost by my colleague Brent.

In the video below, which was streamed live, you can see me explain the internals.

To know more about how to use the package, head over to the readme of spatie/fork on GitHub.

(more…)

By , ago
PHP

Modelling time

This is a very nice talk given by Eric Evans at DDD Europe 2018. He argues that sometimes try to solve a problem, without reaching to existing solutions, might provide good insights.

By , ago
PHP

★ How Flare's GitHub integration works under the hood

[AdSense-A]

Last week, my colleague Ruben and I launched a major new feature at Flare: there's a new integration with GitHub that makes it possible to:

  • create a GitHub issue directly on a Flare error
  • associate a GitHub issue with a Flare error by mentioning a Flare URL in the GitHub issue
  • automatically resolve an error on Flare when you close the GitHub issue
  • automatically close a GitHub issue when you resolve an error in Flare

In this stream, Ruben and I will show you how you can use this integration and how it works under the hood.

(more…)

By , ago