https://github.com/bufferhead-code/nextjs-use-php Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} bufferhead-code / nextjs-use-php Public * Notifications * Fork 0 * Star 42 Use PHP code right within your React / Next.js App. With "use php"; 42 stars 0 forks Activity Star Notifications * Code * Issues 2 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights bufferhead-code/nextjs-use-php This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/b] Use Git or checkout with SVN using the web URL. [gh repo clone buffer] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Gregor Vostrak and Gregor Vostrak readme formatiing ... 395f51f Nov 2, 2023 readme formatiing 395f51f Git stats * 18 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time public Initial commit from Create Next App October 29, 2023 17:22 src support server components November 1, 2023 14:05 .eslintrc.json Initial commit from Create Next App October 29, 2023 17:22 .gitignore add docker-compose notice to readme November 1, 2023 22:55 README.md readme formatiing November 2, 2023 23:22 build.ts support server components November 1, 2023 14:05 docker-compose.yml support server components November 1, 2023 14:05 next.config.js Initial commit from Create Next App October 29, 2023 17:22 package-lock.json add something that is similar to error handling for the build process October 29, 2023 21:11 package.json add something that is similar to error handling for the build process October 29, 2023 21:11 postcss.config.js Initial commit from Create Next App October 29, 2023 17:22 tailwind.config.ts Initial commit from Create Next App October 29, 2023 17:22 tsconfig.json Initial commit from Create Next App October 29, 2023 17:22 View code Next.js use php Build Roadmap (Things that should be fixed but realistically it will never happen) Credits README.md Next.js use php Use PHP right inside of your Next.js project. Just like use server (not really). You can watch how i made it here Youtube Video about how this project was made You can use it in React Server Components just like this: return ( ) And if you want to it can even work with React Client Components // actions.js 'use server' export async function phpHelloWorld() { 'use php' print "Hello from PHP"; } // page.tsx import {phpHelloWorld} from "../actions"; Yes this actually works. Trust me I wish it wouln't too. Build You can build the implementation by npm run build npm run start Open http://localhost:3000 with your browser to see the result. If you want to try out the Database Example, you can use the docker-compose file provided in the repository. after docker-compose up -d you need to create the database and table you want to insert into manually. Roadmap (Things that should be fixed but realistically it will never happen) * [ ] There is a probably a way to fix that nasty preprocess step with SWC Plugins which are still in Beta with Next.js and also I think they will switch builder anyways soon so what's the point really? But hey if anyone wants to do it feel free. * [ ] I guess there is some hacky way to make props binding possible. Credits Check out the original implementations by elnardu for C and Rust: * https://github.com/elnardu/react-use-c * https://github.com/elnardu/react-use-rust --------------------------------------------------------------------- I hope I don't have to say this but: If you even in the slightest consider to use this in any application at all you are an absolute madman and and should be locked out of the internet for the rest of your life, I hope you find some other fun activity, maybe gardening or woodwork. About Use PHP code right within your React / Next.js App. With "use php"; Topics react nodejs php reactjs nextjs Resources Readme Activity Stars 42 stars Watchers 2 watching Forks 0 forks Report repository Releases No releases published Packages 0 No packages published Languages * TypeScript 88.3% * CSS 7.8% * JavaScript 3.9% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.