Category: asynchronous

Dealing with Asynchronous APIs in Server-rendered React

If you’ve ever made a basic React app page, it probably suffered from poor SEO and performance issues on slower devices. You can add back traditional server-side rendering of web pages, typically with NodeJS, but this isn’t a straightforward process, especially with asynchronous APIs. The two main benefits ...

Procedurally Generated Game Terrain with React, PHP, and WebSockets

Last time, I began telling you the story of how I wanted to make a game. I described how I set up the async PHP server, the Laravel Mix build chain, the React front end, and WebSockets connecting all this together. Now, let me tell you about what happened when I starting building the game mechanics with this mix of Rea...

Game Development with React and PHP: How Compatible Are They?

“I’d like to make a multiplayer, economy-based game. Something like Stardew Valley, but with none of the befriending aspects and a player-based economy.” I started thinking about this the moment I decided to try and build a game using PHP and React. The trouble is, I knew nothing about the dynamics of...

Writing Async Libraries – Let’s Convert HTML to PDF

I can barely remember a conference where the topic of asynchronous PHP wasn’t discussed. I am pleased that it’s so frequently spoken about these days. There’s a secret these speakers aren’t telling, though… Making asynchronous servers, resolving domain names, interacting with file systems...

Websockets in Your Synchronous Site

I’m always yammering on about writing asynchronous PHP code, and for a reason. I think it’s healthy to get fresh perspectives – to be exposed to new programming paradigms. Asynchronous architecture is common in other programming languages, but it’s only just finding its feet in PHP. The trouble is that this...

JavaScript Goes Asynchronous (and It’s Awesome)

This article is part of a web development series from Microsoft. Thank you for supporting the partners who make SitePoint possible. JavaScript has come a long way since its early versions and thanks to all efforts done by TC39 (The organization in charge of standardizing JavaScript (or ECMAScript to be exact) we now ha...

Build a Superfast PHP Server in Minutes with Icicle

Event-based programming is a strange topic for PHP developers. In a language as procedural; events are little more than function calls. Nothing happens between events, and all meaningful code is still blocking. Languages like JavaScript show us what PHP could be like if event loops were at the center. Some folks have t...

An Introduction into Event Loops in PHP

PHP developers are always waiting for something. Sometimes we’re waiting for requests to remote services. Sometimes we’re waiting for databases to return rows from a complex query. Wouldn’t it be great if we could do other things during all that waiting? If you’ve written some JS, you’re probably familiar wit...