Skip to content

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Sep 30, 2025

Motivation for the change, related issues

Introduces a beta version of PHP Playground that has a file explorer and a built-in terminal with php, wp, and composer commands available:

CleanShot 2025-09-29 at 01 55 42@2x (1)

It does not replace the existing PHP Playground, only introduces a new beta version. We won't replace the existing one until a few people confirm the new one is useful and stable.

After merging and deploying, it will be available at https://playground.wordpress.net/beta-php-playground.html

This PR supersedes #2694

Implementation details

This PR ships mostly new code and updates code unused anywhere else. The few changes it makes to the shared configuration are non-destructive and mostly don't affect the existing packages.

FilePickerTree component

Ships a substantial update to the FilePickerTree component to:

  • Accept an asynchronous filesystem
  • Consider asynchronous nature of operations in interactions such as initial loading, expanding tree nodes, renaming files
  • Have contextual menu with delete, rename, create file/dir operations
  • Support moving nodes via drag&drop
  • Support "uploading" files from the desktop via drag&drop

It seems like it breaks the "type to focus" interaction. That's fine, we'll fix it in a follow-up. That component isn't used anywhere else at the moment so we're not breaking any other page.

It also ships a few e2e tests to be expanded

New package

This PR ships an additional website-extras package with the beta version of PHP Playground. Why a new package? Because the website packages is built offline-first. We have manifest.json automations in place for PWAs so browsers can download and cache most of the built files. Maintaining a clear separation between required and optional files is a substantial burden. Hence, this PR takes another approach entirely and clearly separates the offline-first parts from the parts we don't need to ask the client to download pre-emptively.

The nx build pipeline will build the remote package, the website package, build the list of assets required for offline mode, prepare the website deployment, and only then it will merge the website-extras into that deployment directory.

Testing Instructions (or ideally a Blueprint)

Go to http://127.0.0.1:5400/website-extras/beta-php-playground.html and play with the beta PHP Playground.

…t more CLI commands, compute the current edited file path
adamziel added a commit that referenced this pull request Sep 30, 2025
Introduced sandboxedSpawnHandlerFactory support for `ls` and `pwd`
commands. This will help Playground provide a useful terminal.

A part of #2699

 ## Testing instructions

CI – this PR comes with a unit test.
adamziel added a commit that referenced this pull request Sep 30, 2025
## Motivation for the change, related issues

Pre-requisite for
#2699. Empowers
developers to create terminal-enabled apps by exporting the
`splitShellCommand()` utility that was internal before.

```ts
import { splitShellCommand } from "@php-wasm/util";
splitShellCommand('wp create post --title="Great post title!"');
['wp', 'create', 'post', '--title=Great post title!']
```
@adamziel adamziel marked this pull request as ready for review October 1, 2025 13:40
@adamziel adamziel requested a review from a team as a code owner October 1, 2025 13:40
@adamziel adamziel changed the title IDE-like PHP playground [Website] IDE-like PHP playground Oct 1, 2025
@adamziel adamziel merged commit 4de21b4 into trunk Oct 1, 2025
27 checks passed
@adamziel adamziel deleted the php-playground-react-app branch October 1, 2025 14:19
Comment on lines +4 to +5
export const DEFAULT_WP_REMOTE = 'http://127.0.0.1:5400/remote.html';
// export const DEFAULT_WP_REMOTE = 'https://playground.wordpress.net/remote.html';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the reason for the error on https://playground.wordpress.net/beta-php-playground.html
Screenshot 2025-10-01 at 17 05 26

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, I'm adjusting this at #2717. We'll need some e2e tests, too, to make sure it keeps working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants