Skip to content

Instantly share code, notes, and snippets.

@dianaarnos
Last active April 18, 2024 13:40
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dianaarnos/e9b827d66ec4c97a351303b2ae2973cf to your computer and use it in GitHub Desktop.
Save dianaarnos/e9b827d66ec4c97a351303b2ae2973cf to your computer and use it in GitHub Desktop.
PHP Assíncrono e Paralelo - Referências

Slides

https://speakerdeck.com/dianaarnos/php-alem-do-sincrono

Exemplos de código

https://github.com/dianaarnos/php-alem-do-sincrono curl_multi speed for PHP - https://gist.github.com/bmatheny/991247
Guzzle e o uso de curl_multi - https://github.com/guzzle/guzzle/blob/a3a20779541ca1ae73d0d3766a83c33d14468f9e/src/Handler/CurlMultiHandler.php

Assíncrono

Coroutines - O que são corrotinas? | Dias de Dev - https://www.youtube.com/watch?v=Nbt0eQHChoI
O que são e como usar Generators | Dias de Dev - https://www.youtube.com/watch?v=1_TnGAxEoPk
Corrotinas e código assíncrono em PHP usando Generators - https://www.treinaweb.com.br/blog/corrotinas-e-codigo-assincrono-em-php-usando-generators
Cooperative multitasking using coroutines (in PHP!) https://nikic.github.io/2012/12/22/Cooperative-multitasking-using-coroutines-in-PHP.html
Generators - https://www.php.net/manual/pt_BR/language.generators.overview.php
What Generators Can Do For You - https://blog.ircmaxell.com/2012/07/what-generators-can-do-for-you.html
Coroutine - https://en.wikipedia.org/wiki/Coroutine
What is a Corountine? - https://www.educative.io/edpresso/what-is-a-coroutine
Managing Concurrency: From Promises to Coroutines - https://sergeyzhuk.me/2018/10/26/from-promise-to-coroutines/
Blocking and non-blocking modes in PHP Streams - https://stackoverflow.com/questions/5294544/blocking-and-non-blocking-modes-in-php-streams
stream_set_blocking - https://www.php.net/manual/pt_BR/function.stream-set-blocking.php
stream_select - https://www.php.net/manual/pt_BR/function.stream-select.php
RFC Fibers - https://wiki.php.net/rfc/fibers
Fiber - https://en.wikipedia.org/wiki/Fiber_(computer_science)
PHP Fibers RFC in PHP 8.1 vs Swoole Fibers and Coroutines - https://www.swoole.co.uk/article/php-fibers-rfc-vs-swoole-co
A Look at the New PHP 8.1 Fibers Feature - https://betterprogramming.pub/a-look-at-the-new-php-8-1-fibers-feature-979489399918
PHP 8.1: Fibers - https://php.watch/versions/8.1/fibers
Swoole - https://www.swoole.co.uk/
PHP Assíncrono com Swoole - https://speakerdeck.com/leocavalcante/php-assincrono-com-swoole
ReactPHP - https://reactphp.org/

Paralelo

Exemplo Parallel: https://github.com/dianaarnos/php-paralelo/blob/master/hello_world.php
Discussão sobre a extensão Parallel - https://www.reddit.com/r/PHP/comments/aquer0/on_parallel_php_the_next_chapter/
Doc da extensão parallel no php.net: https://www.php.net/manual/pt_BR/book.parallel.php
Steve Maraspin - Meet a parallel, asynchronous PHP world -https://www.youtube.com/watch?v=dk-D3g2MD2U
Parallel PHP: The Next Chapter - https://blog.krakjoe.ninja/2019/02/parallel-php-next-chapter.html
ReactPHP - https://reactphp.org/
Doing curl_multi_exec the right way - http://www.adrianworlddesign.com/Knowledge-Base/php/Download-content-with-cURL/Doing-curlmultiexec-the-right-way
Simultaneous cURL requests using curl_multi_exec in PHP - https://webkul.com/blog/simultaneous-curl-requests-in-php/
Fork e pcntl - https://www.php.net/manual/pt_BR/intro.pcntl.php

Geral

The PHP Request Life Cycle - http://php.find-info.ru/php/016/ch20lev1sec5.html
Co-routines as an alternative to state machines - https://eli.thegreenplace.net/2009/08/29/co-routines-as-an-alternative-to-state-machines/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment