Asynchronous PHP and Why you should care as a PHP Developer
In this talk, we will examine how traditional PHP Applications works and their limitations. We'll look into how Asynchronous PHP proffer solutions to some of these problems.
EVOLVE INTO SOMETHING REALLY USEFUL AS COMPARED TO ITS INCEPTION • Better Typing System • Robust CLI SAPI • Long Running Processes • FPM • JIT • Preloading • 2x Speed on PHP 7+ All these improvements are paving ways for more possibilities in the aspect of what PHP can be used for.
• You can’t really do Concurrent stuffs with PHP • Can I do Async in PHP? • Don’t even do Async with PHP just use X or Y or Z • PHP is too Slow for Modern Apps • Just use another Language for concurrent stuffs.
READ FROM DB RENDER VIEW RESPONSE REQ. B PROCESS READ FROM DB RENDER VIEW RESPONSE REQ. A PROCESS READ FROM DB RENDER VIEW A Request style Sample NOTE: The Asynchronous part was Animated
• By NOT HAVING to Wait in the First place. • This is CONCURRENCY! • This is an important advantage we get in Asynchronous Applications. • Since NO WAITING is involved, we have an I/O process that is NON-BLOCKING
• Streams • Promises • No extension Required • Written in PURE PHP React PHP is a low level library for Event Driven programming in PHP • PHP 5.3 Up! • React PHP before React JS • https://reactphp.org
Required • Written in PURE PHP • PHP 5.3 Up! Amp is a Non-Blocking concurrency framework for PHP. • Coroutines Based • Event Loop • Promises • Async Iterators
if you need some Async in your Apps • PHP is Here to Stay • You can reduce Blocking Operations by replacing Synchronous Implementations with Async Implementations when Performance is a concern. • I/Os forms a major part of our Applications and MOST Times they constitutes what makes our apps slow because of blocking operations.