🚀 De PHP synchrone à l’orchestration asynchrone avec Flow
J’ai publié un nouveau POC autour de Darkwood et Flow :
😶🌫️ *This Person Does Not Exist – PHP synchrone à l’orchestration asynchrone avec Flow*
L’objectif n’était pas de rendre un téléchargement plus rapide.
L’objectif était de comprendre ce qui change lorsqu’on passe de synchrone à l’orchestration
Pour l’expérience, j’ai pris une commande Symfony très simple qui télécharge plusieurs images depuis ThisPersonDoesNotExist.
Puis j’ai réalisé une migration minimale :
✅ même logique métier
✅ même fichier
✅ même résultat fonctionnel
Mais avec un changement fondamental :
❌ boucle bloquante sleep()
✅ pipeline orchestré avec Flow Fibers PHP 8.1
Le plus intéressant n’est pas le gain de performance.
Le plus intéressant est le changement de modèle mental :
👉 ne plus raisonner en termes de boucles
👉 raisonner en termes d’unités de travail (Ip)
👉 décrire un pipeline
👉 laisser l’orchestrateur gérer l’exécution
Cette approche est exactement celle que j’explore actuellement pour :
🎥 Scraping YouTube
📝 Extraction de transcripts
🎬 Traitement média
🤖 Agents IA
⚙️ Workflows longue durée
Article complet dans les commentaires 👇
#PHP#Symfony#AsyncPHP#Fibers#SoftwareArchitecture#Darkwood#Flow#OpenSource#Programming#Developer
📖 Nouvel article de blog Darkwood : 😶🌫️ This person does not exist - PHP synchrone à l'orchestration asynchrone avec Flow
👉 à lire ici : blog.darkwood.com/fr/article…
☺️ Bonne lecture
This code looks like @asyncphp code in version 2 using "yield" as an "await". Before moving to Fibers a having async code run without the contagious Generator syntax.
You might also be interested in ReactPHP. Not sure if it still the same but they used at start of Fiber to create together a event loop library:
reddit.com/r/PHP/comments/p1…
PHP Coroutines... and hot potatoes? 🥔🔥
Sounds weird, but it perfectly explains how `yield` and Fibers work.
If you’ve dabbled with them (or avoided them entirely), this post is for you
👉 doeken.org/blog/coroutines-i…#PHP#Coroutines#AsyncPHP
Symfony Pull Request Review🔎
Starting from @symfony 7.2, the HttpClient component now supports amphp/http-client v5. This update enables seamless integration with the latest @asyncphp version, requiring PHP 8.4 due to new fiber handling features. The changes build upon the existing v4 implementation, making necessary adjustments for v5's API.
Thanks to @nicolasgrekas for this contribution! 🙌
github.com/symfony/symfony/p…#Symfony#PHP#OpenSource#HttpClient
no fixed date yet, but we have a set of features that we need to implement in order for it to be released. Neu uses @asyncphp HTTP Server / Cluster, which are production ready already!
i can create an async driver for doctrine using amp/postgres in 10 minutes, but it will most likely not work ( memory leaks, ..etc ), because doctrine is stateful, it was not created with the idea of running for a long time, or executing commands/queries concurrently.
PHP packages can support async today, if they stop writing code that is stateful, that is the only thing stopping Symfony and other frameworks from being async-first.
we are getting there, Fibers allowed use to get out of the callback hell we once had, and that is the first building block for hopefully an built-in event loop in the future, but, other than a built-in even loop, i don't see the need for other things in PHP core.
I believe amp-psl are 100% compatiable, as they use the same event loop (revolt), react uses its own event loop, which is not a huge issue, you can make it compatiable using react/promise ( fibers ), or, to make react use the revolt event loop: github.com/revoltphp/event-l…