Build-in PHP server previews command

I’ve started with Blank Workspace template for play with PHP on platform.
So my question about configuration of dev.nix file
I have index.php in root folder and I start Build-in PHP server with onStart = directive for workspace… But I don’t understans what i suppose to write for previews = { enable = true; }; to see web preview for started server? Can you show me example?
workspace example -

Now IDX support PHP Template on Backend category.

Or try this config on your dev.nix file base on IDX PHP template.

    previews = {
      enable = true;
      previews = {
        web = {
          # Example: run "npm run dev" with PORT set to IDX's defined port for previews,
          # and show it in IDX's web preview panel
          command = ["php" "-S" "localhost:$PORT"];
          manager = "web";
          # env = {
          #   # Environment variables to set for your server
          #   PORT = "$PORT";
          # };
1 Like

Yeah Thanks it’s helped.
Removed running script on start with your command and it’s work!
Thanks a lot.
Nice to see as Google use Nix power for such nice product.
Will try migrate some code here from Replit.


Let us know if you run into any issues! Our goal with Nix is to make it easy to port your development environment from your local setup or from other online steps into IDX with no hassle :truck:

1 Like