Your PHP code in index.php, running on Cloudflare Workers
This project uses babel-preset-php to convert PHP to JavaScript.
To generate using wrangler
wrangler generate projectname https://github.com/cloudflare/php-worker-hello-world
Further documentation for Wrangler can be found here.
cd projectname
# run once to install babel-preset-php and dependencies
npm install
# run every time you update index.php
npm run build
That will compile your code into index.js, after which you can run wrangler publish
to push it to Cloudflare.
For more information on how PHP translates to JavaScript, see the docs for babel-preset-php.