Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Environment: Add support for executing an arbitrary PHP file #242

Closed
danielbachhuber opened this issue May 3, 2023 · 1 comment
Closed
Assignees

Comments

@danielbachhuber
Copy link
Member

One of our project goals is:

The php command will simply pass executions back to the WebAssembly PHP build. Output will stream back to the user as expected. PHPUnit and WP-CLI can be used by running wp-now php , and we may include user-friendly wrappers for them.

Done is:

  • It's possible to execute an arbitrary PHP file with wp-now php.
@adamziel
Copy link
Collaborator

adamziel commented May 5, 2023

This could lean on running PHP in the cli mode, much like php-wasm/cli:

php.cli(['php', ...args]).catch((result) => {

Keep in mind that once the cli() call is finished, the PHP instance is no longer usable for running code.

adamziel pushed a commit that referenced this issue May 18, 2023
- Related to
#242

## Proposed changes

- Create a new `php` command to execute php files
- Tests for `executePHPFile`

`wp-cli` will have its separate command in a different PR.

## Testing instructions

- Create a simple php. e.g. `example.php`: `<?php echo "Hello World!";`
- Copy the relative or absolute path to that file
- Execute `npx nx preview wp-now php ~/path-to/example.php`
- Modify your `example.php` to add WordPress functions: e.g. `<?php echo
get_bloginfo();`
- Execute `npx nx preview wp-now php ~/path-to/example.php
--path=/path-to-your-plugin/gutenberg` // To load WordPress needs to be
executed in a mode different than `index`.

---------

Co-authored-by: Daniel Bachhuber <[email protected]>
@sejas sejas closed this as completed May 18, 2023
Pookie717 added a commit to Pookie717/wordpress-playground that referenced this issue Oct 1, 2023
- Related to
WordPress/wordpress-playground#242

## Proposed changes

- Create a new `php` command to execute php files
- Tests for `executePHPFile`

`wp-cli` will have its separate command in a different PR.

## Testing instructions

- Create a simple php. e.g. `example.php`: `<?php echo "Hello World!";`
- Copy the relative or absolute path to that file
- Execute `npx nx preview wp-now php ~/path-to/example.php`
- Modify your `example.php` to add WordPress functions: e.g. `<?php echo
get_bloginfo();`
- Execute `npx nx preview wp-now php ~/path-to/example.php
--path=/path-to-your-plugin/gutenberg` // To load WordPress needs to be
executed in a mode different than `index`.

---------

Co-authored-by: Daniel Bachhuber <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants