PHP Fibers - Milko Kosturkov - PHP UK 2022

Discover the benefits of using PHP Fibers, a unique approach to asynchronous programming that can improve efficiency, scalability, and responsiveness, and learn how to apply them to optimize your PHP applications.

Key takeaways
  • Fibers are not threads and cannot be interrupted by other fibers or processes.
  • Fibers are cheaper to switch than threads and can suspend themselves.
  • Fibers are useful for input/output intensive tasks, such as downloading files and handling network latency.
  • Fibers can be accessed anywhere from the stack and can suspend themselves.
  • Fibers are cooperative and need to be manually suspended and resumed by the programmer.
  • The programmer is in control of scheduling and giving the order of execution.
  • Fibers can be used to create asynchronous programming without using callbacks or events.
  • Fibers can be used to refactor synchronous code to be asynchronous.
  • The author recommends using fibers for input/output intensive tasks, such as downloading files and handling network latency.
  • Fibers can be used to create a more efficient and scalable program.
  • Fibers can be used to handle multiple requests concurrently.
  • Fibers can be used to create a more reactive and responsive program.
  • Fibers can be used to create a more efficient and scalable program that can handle multiple requests concurrently.
  • Fibers can be used to create a more reactive and responsive program that can handle multiple requests concurrently.