Write PHP in Next.js/React Components
Bufferhead
Sometimes going back is the only way forward that's why you can now write PHP Code directly within JSX in React Components. Since the latest release of Next.js 14 by Vercel "Server Actions" are stable which means it is easier than ever to execute Server Side Javascript Code from right within React Components without writing API Endpoints manually. But we can go further. Let's make in run with the best Programming Language in existence: PHP. Run PHP Code with in React and Next.js!
You can find the running code in this GitHub Reporistor: https://github.com/bufferhead-code/nextjs-use-php
Shoutout to elnardu (https://github.com/elnardu) who came up with the initial implementation for react "use c" and "use rust": https://github.com/elnardu/react-use-c https://github.com/elnardu/react-use-rust
All of this is possible because of the amazing advancements in the web development ecosystem especially with frontend technologies getting better and better through frameworks like Next.js, Nuxt.js SvelteKit and more. Server Side Rendered Javascript Components and Server Side Javascript Code are the Backbone of Modern Frontend Applications as they allow feature-rich and beautiful applications without the overhead of building REST APIs for everything. Programming Code is getting less separation of concerns with is probably not a great thing but I'm sure the counter movement will come soon. Frontend vs Backend? Why not Both! This video probably contains things that Vercel wouldn't want you to do, and wouln't should you. This is very cursed. Please don't use this pattern in production.
Music from #Uppbeat (free for Creators!): https://uppbeat.io/t/hartzmann/purple-lines License code: VQSIDLUGY9ITEWQD ... https://www.youtube.com/watch?v=EGOkjmyfL6E
24568877 Bytes