Using the Concurrency Facade with Laravel Herd
Taylor Otwell recently added a new Concurrency facade which he announced at Laracon 2024. This is a great feature as it allows for multiple concurrent tasks at the same time. If you're like me, this is a game-changer when running multiple analytical queries, as the time each one takes adds up fast.
However, at the time of writing, the Concurrency facade doesn't yet work with Laravel Herd. There's an open pull request within Symfony that fixes this.
If you're feeling impatient, you can add the following workaround to your AppServiceProvider:
public function boot()
{
if(app()->environment('local')) {
// set the PHP_BINARY env
$path = getenv('HERD_HOME') . \DIRECTORY_SEPARATOR . 'bin';
$phpBinary = (new ExecutableFinder)->find('php', false, [$path]);
putenv('PHP_BINARY=' . $phpBinary);
}
}Thanks to Marcel Pociot's PR for the HERD_HOME env variable insight.
If you're interested in the full pull request, you can find it here. Once it's merged, you can remove this workaround from your AppServiceProvider.