Using Google IDX/Firebase Studio for PHP
Context or Problem
Skill Issue
Experiment
Tried using Google IDX → Firebase Studio for PHP today 🤗.
Turns out the dev.nix
file can set up everything you need for a project—kind of like Docker. Need PHP, Composer, MySQL? Just list the packages and enable the services.
I gave Laravel 12 a shot. Firebase Studio even has an official Laravel template, but it wasn’t quite right—had asset URL issues and CSRF headaches. I’m so over that, especially since I hit the same snag on GitHub Codespaces and GitPod (cloud editors like IDX).
So I started fresh with a blank template: added php83
, php83Packages.composer
, and enabled MySQL, all in dev.nix
. No need to install Node.js manually—IDX gives you that by default.
How to use it?
There really isn’t a “one-command” install—you manually list everything inside dev.nix
. The upside: you can spin up multiple Laravel projects in one IDX instance (you’re limited to 10 projects per account). For example:
laravel new project1 && cd project1laravel new project2 && cd project2
Sounds great…except it didn’t work! Composer was acting dumb and wouldn’t run the laravel
command, even though I’d installed it globally. Checking $PATH
or running export
showed no path to the global Composer bin.
Long story short, I had to manually export the path in dev.nix
:
COMPOSER_GLOBAL_PACKAGE = "/home/user/.config/composer/vendor/bin"
Now I run global Composer binaries like:
$COMPOSER_GLOBAL_PACKAGE/laravel new project_name
Not perfect, but it works.
Of course php artisan
command will also works fine without $COMPOSER_GLOBAL_PACKAGE
, you can also just change that long name to something that you can use and remeber easier.
After that, I installed the Livewire starter kit—smooth as butter. Don’t forget to run npm run dev
(or composer run dev
) to recompile the Tailwind CSS.
Conclusion: I want a dev environment with PHP + Laravel 12 + Livewire + Composer + MySQL in Google IDX or Firebase Studio…but the laravel new
command refuses to run.
Next up: King WordPress
NOTE In this article I fail to do it, but finally found a way to fix it on my new journal Finally I Can Develop WordPress Project in Firebase Studio IDX
-
Installed normally with Composer in
/real-wp
, then served viaTerminal window php -S localhost:8080Installation worked, but I got stuck in an infinite redirect loop—assets were still loading over
http
instead ofhttps
. Tweakingsiteurl
,homeurl
, and port didn’t help. At least/wp-admin
was accessible. -
Tried again with WP-CLI:
Terminal window wp serverThe blog showed up with correct asset URLs, but suddenly
/wp-admin
broke. Go figure. -
Next: Docker, using the official WordPress image from Docker Hub. Copied the default
docker-compose.yml
, thenbuild
andup
. Same redirect problem. All ports are public; otherwise you have to log into Google first.
Final thoughts: The issue doesn’t seem to be WordPress. IDX is messing with http
/https
and port 8080 redirects in some weird way. I’m baffled. Skill issue out.