"React Now Looks Like PHP" They Said

Rate this content
Bookmark

This session aims to show JavaScript developers how PHP concepts, especially those honed in Drupal development, can enrich their approach to React applications. It will cover how PHP's server-side strengths and Drupal's modular architecture can inform and enhance client-side development in React. The talk will include practical examples of integrating Drupal with React, emphasizing how PHP's backend prowess can be leveraged in a JavaScript-dominated environment. The session promises to be an eye-opener for React developers, offering them new perspectives and tools drawn from the PHP world, ultimately leading to more robust, efficient, and innovative web applications.

This talk has been presented at React Summit 2024, check out the latest edition of this React Conference.

FAQ

The presenter's main motivation was to bring the PHP and JavaScript communities closer together and share information to build cool stuff together.

The presenter started their web development journey in 1999 with Perl and soon after adopted PHP, writing their first PHP server-side code in the same year.

The presenter demonstrated a guestbook application, showcasing its development in four different versions using PHP from 1999 to modern PHP, React 2017, and React 2024.

Modern PHP, like React, allows for reactive applications with component-based development. Tools like Livewire in Laravel and DrupalWire in Drupal enable writing backend code that delivers the necessary JavaScript for frontend reactivity.

React Server Components provide a simpler architecture by allowing data fetching, security, caching, and performance to be managed on the backend while using a single language (JavaScript) for both frontend and backend development.

The presenter compares PHP 1999 and React 2024 by showing that many concepts in React 2024, like server-side rendering and component-based architecture, were already present in PHP 1999, albeit with modern enhancements.

Isomorphic rendering in React allows the same components to be used for both server-side and client-side rendering, providing flexibility and enabling the use of client-side browser features like Canvas and WebGL.

The evolution of frontend and backend development has led to more integrated approaches where backend capabilities are brought into frontend frameworks like React, simplifying architecture and improving developer and user experiences.

The presenter's agency uses an approach that integrates headless CMS with frontend applications, allowing direct and secure access to microservices and data sources, simplifying projects and enhancing flexibility and feature richness.

NodeHive is a headless content management system founded by the presenter. It is built for Next.js in the frontend and is described as very cool.

Lukas Fischer
Lukas Fischer
21 min
18 Jun, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
This Talk explores the similarities between React and PHP, particularly in building a guestbook. It showcases the shift towards back-end development and the use of modern PHP frameworks like Drupal. The integration of front-end code in the back-end is discussed, as well as the benefits of React server components. The comparison between PHP 99 and React 2024 highlights the advantages of using React in PHP development. The Talk concludes with excitement for the future of JavaScript, React, PHP, and Drupal.

1. Introduction to React and PHP

Short description:

Welcome to this presentation about React and PHP. I'll share my experience and code examples from 1999 to show how React resembles PHP. I'll also discuss the shift towards back-end development. I'm Lucas, founder of Netnode and NodeHive. Let's build a guestbook!

Yeah, welcome to this presentation about React looks like PHP, they said. I'm very happy to actually present at React Summit, and I'm excited to share my learnings. Traditionally, I'm coming from the PHP community, adopting React since a couple of years.

My thought was really to bring the PHP and JavaScript community closer together. I want to say I don't want to hate about React Server Components or PHP or whatever framework. For me, it's really about sharing information, build cool stuff together. That was the motivation to make this call and this session.

And maybe you remember this slide or this visualization when next JS14 came out, there was quite a bit of a rant that React now is like PHP. And so that also made me interested because traditionally, I came from PHP, as I just said. Because it was very hilarious and funny. And actually, I looked up a couple of memes back then, for example, that one on the right, I like a lot. So React, def looking at next JS and actually it's like PHP. I don't know.

So I decided to actually make a presentation out of it and give a little bit of context of my experience in the past. Because when I started and actually I started in 1999 when I was, I don't know, 16, 17 years old, I went came into web development. Personally, I started with Perl back then. And soon after, I adopted PHP and literally, I wrote my first PHP server side code in 1999. And I want to actually show you a lot of code today to make this comparison, why people say React looks like PHP today. So I will show a code example from 1999 and show how modern PHP looks like with its symphony components and how actually the back end PHP code comes closer to the front end. Then I will show a traditional single page application and then show how the React framework actually is going towards the back end.

A little bit about myself. So my name is Lucas. I'm can be found on Twitter with Lucas Fisher. I'm the founder and run Netnode, a digital agency here in Switzerland. And I also founded NodeHive as a startup. NodeHive is a headless content management system. Check it out. It's very cool. And it's very much built for Next.js in the front end. So what we're going to build today in four different versions is a guestbook.

2. Building a Guestbook with PHP

Short description:

In the late 1990s to early 2000s, guestbooks were popular on websites as a way for visitors to interact. I will show you how a guestbook was built using PHP in 1999, with a simple form and a list of entries. The code includes HTML, CSS, and the form and listing components.

And maybe you remember the good old times. Maybe not. But this was very popular around 1999 to maybe 2003 or so. Every website had a guestbook. So there was no social media. There was not even a blogosphere or something like that. And so going onto a website was very boring. The only thing you could probably do is sign the guestbook on the website.

So what it is a simple form. And then you have a list of the guestbook entries on the website. And I will show how that's built in PHP as of 1999. So I prepared here four versions of the same application. And I quickly explain how that looks like. So I just go into the folder. And then I run the server. So when I open it, this is our wonderful 1999 guestbook. So you see here a listing and then the form. I fill out the form. Hello. I submit it. And then it says thank you. And I can go back. I only made a mock. So there is not really a database in the back. So we don't save it.

So how is that built using traditional PHP? So let's dive into the code. First of all, we have something like index PHP. And when you look at it, so we have the HTML. We have a little bit of CSS. And then we include the form, the upper part, and then also the listing.