SlideShare a Scribd company logo
Introducing React into
PHP app
Piotr Wojnarowski
Tomasz Piekarczyk
● Online shop, millions of visitors annually
● Big app, hard to maintain, slow
● Web app for desktop in PHP,
mobile in React
● 65k lines of PHP, 20k lines of JS
Italist
Extract template
rendering from PHP,
use React to create UI
Unify web app for
desktop and mobile
Separate apps for
different parts of the
page: shop, account,
admin, checkout
Divide backend into
smaller services
What are we aiming for?
Strong separation
of layers between
frontend and backend
Easier to test
the JS part of it
Easier to maintain
smaller apps
Allow an easier refactor
of the back end
What's to be gained?
Technology stack
GoalBefore Now
● A big release when everything is ready
● Deadline we need to keep
● Risk of overlooking features or pages
How to do it? Just rewrite it!
Requirements
Design
Implementation
Testing
Deployment
Maintenance
● Single React app for single page
● Small, iterative releases
● Working product at every point
● Gradually removing old code, nothing
should be overlooked
Introduce React iteratively
Multiple React Apps
Injecting data in React
PHP
Views
Controllers
Routing
Injecting data in React – approach 1
PHP
Page
API
Page
API
React
JSON
Injecting data in React – approach 2
PHP
React
Controllers
Routing
Injecting data in React – simplistic view
Before you start – automatic tests
• Regression risk – e2e at least for critical paths
• Prefer structure agnostic selectors
• Proper research before selecting testing tooling
• Tests have to run as part of CD/CI cycle
Before you start – common store
• Combining multiple apps into one
• Datatype mismatch will reveal at last stage – runtime
• Tackle by:
 Extracting common code to a library/module
 Introduce static typing – typescript
Our app’s html
Single Page Application
Download
minimal HTML
Download JS Execute React
Page fully
usable
Is SPA right for e-commerce
Possible SEO issues
Slow initial load
Nothing displays during initial load until done
Fast subsequent pages
Server Side Rendered html
Server Side Rendering
Download
pre-rendered
HTML
Download JS Execute React
Page fully
usable
Comparison
Possible SEO issues
Slow initial load
Nothing displays during initial
load until done
Fast subsequent pages
SPA
No issues with indexing and
ranking
Fast initial load
Displays content even before
react is loaded
Slower subsequent pages
SSR
Need a node server
• Build on top of React
• Supports Redux
• Requires Node backend
• Code needs to run on server
and client
Required changes - structure
Top level components reside
in pages directory
Required changes - data
Data usually fetched in
componentDidMount() in React
In next.js through
getInitialProps()
Required changes – client routing
Use Link for client side
navigation
Use withRouter to access
Router singleton
Conclusions
• It can be done ☺
• Iterative React introduction is easy
• Remember the e2e tests
• SSR works for online shopping
• 36k lines of PHP, 37k lines of JS
Thank you
Ad

Recommended

React BKK: Scalable Application Architecture
React BKK: Scalable Application Architecture
Zack Siri
 
Lessons Learned from Using Next.js in Production
Lessons Learned from Using Next.js in Production
Panjamapong Sermsawatsri
 
Rencore Webinar: SharePoint Customizations - the most overlooked road block t...
Rencore Webinar: SharePoint Customizations - the most overlooked road block t...
Rencore
 
Go Faster with Lightning Process Builder
Go Faster with Lightning Process Builder
Salesforce Developers
 
Benefits of developing single page web applications using angular js
Benefits of developing single page web applications using angular js
Harbinger Systems - HRTech Builder of Choice
 
Webhooks in Microsoft SharePoint Online
Webhooks in Microsoft SharePoint Online
Netwoven Inc.
 
Ahmedabad Salesforce Meetup
Ahmedabad Salesforce Meetup
Shankar Sharma
 
Era of server less computing final
Era of server less computing final
Baskar rao Dsn
 
EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
Evolve The Adobe Digital Marketing Community
 
Sahi
Sahi
Sohail Ahmed
 
Kovair Requirements Management
Kovair Requirements Management
Kovair
 
Introduction to Office Development Topics
Introduction to Office Development Topics
Haaron Gonzalez
 
Salesforce Apex Hours: Einstein Intent
Salesforce Apex Hours: Einstein Intent
Amit Chaudhary
 
Mobile CMS made simple
Mobile CMS made simple
Jonathan Schmid
 
What's new in visual studio 2013
What's new in visual studio 2013
Taiseer Joudeh
 
Building your first app for share point 2013
Building your first app for share point 2013
Muawiyah Shannak
 
Dhabale,Lingaraj-Resume
Dhabale,Lingaraj-Resume
Lingaraj Dhabale
 
Salesforce Apex Hours: What means Winter 18 for Developers
Salesforce Apex Hours: What means Winter 18 for Developers
Amit Chaudhary
 
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Tobias Lekman
 
Flex And Php 101
Flex And Php 101
Kalimulla Kattubadi
 
SharePoint Apps 101
SharePoint Apps 101
Ronald Courville
 
Core Web Vitals - The Modern Web Experience
Core Web Vitals - The Modern Web Experience
Cakra Danu Sedayu
 
Implement lazy loading in your existing angular application (get a faster, be...
Implement lazy loading in your existing angular application (get a faster, be...
Katy Slemon
 
Developing Apps for SharePoint 2013
Developing Apps for SharePoint 2013
SPC Adriatics
 
Dynamic Rendering for SEO by Nati Elimelech
Dynamic Rendering for SEO by Nati Elimelech
Nati Elimelech
 
Dealing with Performance in SharePoint Server - SPSVancouver
Dealing with Performance in SharePoint Server - SPSVancouver
Jason Warren
 
Core Web Vitals: Google New Ranking Factor
Core Web Vitals: Google New Ranking Factor
EneblurConsultingweb
 
Google Core Web Vitals - Webinar
Google Core Web Vitals - Webinar
Spike
 
Integrating React.js Into a PHP Application: Dutch PHP 2019
Integrating React.js Into a PHP Application: Dutch PHP 2019
Andrew Rota
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
Denis Izmaylov
 

More Related Content

What's hot (20)

EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
EVOLVE'16 | Enhance | Paul McMahon | Approaches to Leveraging AEM Within a Si...
Evolve The Adobe Digital Marketing Community
 
Sahi
Sahi
Sohail Ahmed
 
Kovair Requirements Management
Kovair Requirements Management
Kovair
 
Introduction to Office Development Topics
Introduction to Office Development Topics
Haaron Gonzalez
 
Salesforce Apex Hours: Einstein Intent
Salesforce Apex Hours: Einstein Intent
Amit Chaudhary
 
Mobile CMS made simple
Mobile CMS made simple
Jonathan Schmid
 
What's new in visual studio 2013
What's new in visual studio 2013
Taiseer Joudeh
 
Building your first app for share point 2013
Building your first app for share point 2013
Muawiyah Shannak
 
Dhabale,Lingaraj-Resume
Dhabale,Lingaraj-Resume
Lingaraj Dhabale
 
Salesforce Apex Hours: What means Winter 18 for Developers
Salesforce Apex Hours: What means Winter 18 for Developers
Amit Chaudhary
 
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Tobias Lekman
 
Flex And Php 101
Flex And Php 101
Kalimulla Kattubadi
 
SharePoint Apps 101
SharePoint Apps 101
Ronald Courville
 
Core Web Vitals - The Modern Web Experience
Core Web Vitals - The Modern Web Experience
Cakra Danu Sedayu
 
Implement lazy loading in your existing angular application (get a faster, be...
Implement lazy loading in your existing angular application (get a faster, be...
Katy Slemon
 
Developing Apps for SharePoint 2013
Developing Apps for SharePoint 2013
SPC Adriatics
 
Dynamic Rendering for SEO by Nati Elimelech
Dynamic Rendering for SEO by Nati Elimelech
Nati Elimelech
 
Dealing with Performance in SharePoint Server - SPSVancouver
Dealing with Performance in SharePoint Server - SPSVancouver
Jason Warren
 
Core Web Vitals: Google New Ranking Factor
Core Web Vitals: Google New Ranking Factor
EneblurConsultingweb
 
Google Core Web Vitals - Webinar
Google Core Web Vitals - Webinar
Spike
 
Kovair Requirements Management
Kovair Requirements Management
Kovair
 
Introduction to Office Development Topics
Introduction to Office Development Topics
Haaron Gonzalez
 
Salesforce Apex Hours: Einstein Intent
Salesforce Apex Hours: Einstein Intent
Amit Chaudhary
 
What's new in visual studio 2013
What's new in visual studio 2013
Taiseer Joudeh
 
Building your first app for share point 2013
Building your first app for share point 2013
Muawiyah Shannak
 
Salesforce Apex Hours: What means Winter 18 for Developers
Salesforce Apex Hours: What means Winter 18 for Developers
Amit Chaudhary
 
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Tobias Lekman
 
Core Web Vitals - The Modern Web Experience
Core Web Vitals - The Modern Web Experience
Cakra Danu Sedayu
 
Implement lazy loading in your existing angular application (get a faster, be...
Implement lazy loading in your existing angular application (get a faster, be...
Katy Slemon
 
Developing Apps for SharePoint 2013
Developing Apps for SharePoint 2013
SPC Adriatics
 
Dynamic Rendering for SEO by Nati Elimelech
Dynamic Rendering for SEO by Nati Elimelech
Nati Elimelech
 
Dealing with Performance in SharePoint Server - SPSVancouver
Dealing with Performance in SharePoint Server - SPSVancouver
Jason Warren
 
Core Web Vitals: Google New Ranking Factor
Core Web Vitals: Google New Ranking Factor
EneblurConsultingweb
 
Google Core Web Vitals - Webinar
Google Core Web Vitals - Webinar
Spike
 

Similar to From PHP to React - case study (20)

Integrating React.js Into a PHP Application: Dutch PHP 2019
Integrating React.js Into a PHP Application: Dutch PHP 2019
Andrew Rota
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
Denis Izmaylov
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
Andrew Rota
 
Server side rendering with React and Symfony
Server side rendering with React and Symfony
Ignacio Martín
 
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
IbadUddin4
 
WordCamp Bucharest 2017
WordCamp Bucharest 2017
Alexandra Anghel
 
Full Stack_Reac web Development and Application
Full Stack_Reac web Development and Application
Jeyarajs7
 
React js
React js
Nikhil Karkra
 
ULTIMATE REASONS TO PREFER REACT FOR YOUR WEB DEVELOPMENT PROJECT.pptx
ULTIMATE REASONS TO PREFER REACT FOR YOUR WEB DEVELOPMENT PROJECT.pptx
BOSC Tech Labs
 
Why is React Development so in demand.pdf
Why is React Development so in demand.pdf
Mverve1
 
Top Reasons to Use ReactJS for Web Development
Top Reasons to Use ReactJS for Web Development
Oliver Grady
 
Creating Hyper Performant Web Apps with React
Creating Hyper Performant Web Apps with React
Jp DeVries
 
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Stack Learner
 
WordCamp Athens 2017 - Building an E-commerce Progressive Web App with React ...
WordCamp Athens 2017 - Building an E-commerce Progressive Web App with React ...
Alexandra Anghel
 
React seo tips to build seo friendly web applications
React seo tips to build seo friendly web applications
Katy Slemon
 
Professionalizing the Front-end
Professionalizing the Front-end
Jordi Anguela
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
MskDotNet Community
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
 
Mastering react with redux
Mastering react with redux
Gaurav Singh
 
Learn react-js
Learn react-js
C...L, NESPRESSO, WAFAASSURANCE, SOFRECOM ORANGE
 
Integrating React.js Into a PHP Application: Dutch PHP 2019
Integrating React.js Into a PHP Application: Dutch PHP 2019
Andrew Rota
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
Denis Izmaylov
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
Andrew Rota
 
Server side rendering with React and Symfony
Server side rendering with React and Symfony
Ignacio Martín
 
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
intro to react| React: dynamic UIs, component-based, virtual DOM, JSX, effici...
IbadUddin4
 
Full Stack_Reac web Development and Application
Full Stack_Reac web Development and Application
Jeyarajs7
 
ULTIMATE REASONS TO PREFER REACT FOR YOUR WEB DEVELOPMENT PROJECT.pptx
ULTIMATE REASONS TO PREFER REACT FOR YOUR WEB DEVELOPMENT PROJECT.pptx
BOSC Tech Labs
 
Why is React Development so in demand.pdf
Why is React Development so in demand.pdf
Mverve1
 
Top Reasons to Use ReactJS for Web Development
Top Reasons to Use ReactJS for Web Development
Oliver Grady
 
Creating Hyper Performant Web Apps with React
Creating Hyper Performant Web Apps with React
Jp DeVries
 
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Frontend Development Bootcamp - React [Online & Offline] In Bangla
Stack Learner
 
WordCamp Athens 2017 - Building an E-commerce Progressive Web App with React ...
WordCamp Athens 2017 - Building an E-commerce Progressive Web App with React ...
Alexandra Anghel
 
React seo tips to build seo friendly web applications
React seo tips to build seo friendly web applications
Katy Slemon
 
Professionalizing the Front-end
Professionalizing the Front-end
Jordi Anguela
 
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
Дмитрий Тежельников «Разработка вэб-решений с использованием Asp.NET.Core и ...
MskDotNet Community
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
Marco Breveglieri
 
Mastering react with redux
Mastering react with redux
Gaurav Singh
 
Ad

Recently uploaded (20)

Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
Artificial Intelligence in the Nonprofit Boardroom.pdf
Artificial Intelligence in the Nonprofit Boardroom.pdf
OnBoard
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Ad

From PHP to React - case study

  • 1. Introducing React into PHP app Piotr Wojnarowski Tomasz Piekarczyk
  • 2. ● Online shop, millions of visitors annually ● Big app, hard to maintain, slow ● Web app for desktop in PHP, mobile in React ● 65k lines of PHP, 20k lines of JS Italist
  • 3. Extract template rendering from PHP, use React to create UI Unify web app for desktop and mobile Separate apps for different parts of the page: shop, account, admin, checkout Divide backend into smaller services What are we aiming for?
  • 4. Strong separation of layers between frontend and backend Easier to test the JS part of it Easier to maintain smaller apps Allow an easier refactor of the back end What's to be gained?
  • 6. ● A big release when everything is ready ● Deadline we need to keep ● Risk of overlooking features or pages How to do it? Just rewrite it! Requirements Design Implementation Testing Deployment Maintenance
  • 7. ● Single React app for single page ● Small, iterative releases ● Working product at every point ● Gradually removing old code, nothing should be overlooked Introduce React iteratively
  • 9. Injecting data in React PHP Views Controllers Routing
  • 10. Injecting data in React – approach 1 PHP Page API Page API React JSON
  • 11. Injecting data in React – approach 2 PHP React Controllers Routing
  • 12. Injecting data in React – simplistic view
  • 13. Before you start – automatic tests • Regression risk – e2e at least for critical paths • Prefer structure agnostic selectors • Proper research before selecting testing tooling • Tests have to run as part of CD/CI cycle
  • 14. Before you start – common store • Combining multiple apps into one • Datatype mismatch will reveal at last stage – runtime • Tackle by:  Extracting common code to a library/module  Introduce static typing – typescript
  • 16. Single Page Application Download minimal HTML Download JS Execute React Page fully usable
  • 17. Is SPA right for e-commerce Possible SEO issues Slow initial load Nothing displays during initial load until done Fast subsequent pages
  • 19. Server Side Rendering Download pre-rendered HTML Download JS Execute React Page fully usable
  • 20. Comparison Possible SEO issues Slow initial load Nothing displays during initial load until done Fast subsequent pages SPA No issues with indexing and ranking Fast initial load Displays content even before react is loaded Slower subsequent pages SSR Need a node server
  • 21. • Build on top of React • Supports Redux • Requires Node backend • Code needs to run on server and client
  • 22. Required changes - structure Top level components reside in pages directory
  • 23. Required changes - data Data usually fetched in componentDidMount() in React In next.js through getInitialProps()
  • 24. Required changes – client routing Use Link for client side navigation Use withRouter to access Router singleton
  • 25. Conclusions • It can be done ☺ • Iterative React introduction is easy • Remember the e2e tests • SSR works for online shopping • 36k lines of PHP, 37k lines of JS