• Stars
    star
    1,612
  • Rank 29,031 (Top 0.6 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run WordPress in the browser via WebAssembly PHP

WordPress Playground and PHP WASM (WebAssembly)

Project Page | Live demo | Documentation and API Reference

WordPress Playground is an experimental in-browser WordPress that runs without a PHP server thanks to the magic of WebAssembly.

Why is WordPress Playground useful?

WordPress Playground exists to make WordPress instantly accessible for users, learners, extenders, and contributors by building foundational software tools developers can use to create interactive, zero-setup, JavaScript applications with WordPress.

Playground aims to facilitate:

– Learning WordPress Through Exploration – Learning WordPress Development Through Writing Code – Instant access to WordPress ecosystem

Learn more about the vision and the roadmap.

Getting started

WordPress Playground has a live demo available.

You can embed WordPress Playground in your project via an <iframe> – find out how in the documentation. Note the embed is experimental and may break or change without a warning.

You can connect to the Playground using the JavaScript client. Here's an example of how to do it in the browser using an iframe HTML element and the startPlaygroundWeb function from the @wp-playground/client package.

index.html:

<!DOCTYPE html>
<iframe id="wp-playground" style="width: 1200px; height: 800px"></iframe>
<script type="module">
	import { startPlaygroundWeb } from 'https://unpkg.com/@wp-playground/client/index.js';

	const client = await startPlaygroundWeb({
		iframe: document.getElementById('wp-playground'),
		remoteUrl: `https://playground.wordpress.net/remote.html`,
		blueprint: {
			landingPage: '/wp-admin/',
			preferredVersions: {
				php: '8.0',
				wp: 'latest',
			},
			steps: [
				{
					step: 'login',
					username: 'admin',
					password: 'password',
				},
				{
					step: 'installPlugin',
					pluginZipFile: {
						resource: 'wordpress.org/plugins',
						slug: 'friends',
					},
				},
			],
		},
	});

	const response = await client.run({
		code: '<?php echo "Hi!"; ',
	});
	console.log(response.text);
</script>

WordPress Playground Tools

WordPress Playground Tools are independent applications built on top of WordPress Playground. They are located in a different repository: WordPress/playground-tools.

These tools include:

Cloning WordPress Playground repo

The vanilla git clone command will take ages. Here's a faster alternative that will only pull the latest revision of the trunk branch:

git clone -b trunk --single-branch --depth 1 [email protected]:WordPress/wordpress-playground.git

Running WordPress Playground locally

You also can run WordPress Playground locally as follows:

git clone -b trunk --single-branch --depth 1 [email protected]:WordPress/wordpress-playground.git
cd wordpress-playground
npm install
npm run dev

A browser should open and take you to your very own client-side WordPress at http://127.0.0.1:5400/!

Any changes you make to .ts files will be live-reloaded. Changes to Dockerfile require a full rebuild.

From here, the documentation will help you learn how WordPress Playground works and how to use it to build amazing things!

And here's a few more interesting CLI commands, which expect that you have nx installed globally:

# Build and run PHP.wasm CLI
nx start php-wasm-cli

# Build latest WordPress releases
nx recompile-wordpress:all playground-remote

# Recompile PHP 5.6 - 8.2 releases to .wasm for web
nx recompile-php:all php-wasm-web

# Recompile PHP 5.6 - 8.2 releases to .wasm for node
nx recompile-php:all php-wasm-node

# Builds the documentation site
nx build docs-site

# Builds the Playground Client npm package
nx build playground-client

# Bonus: Run PHP.wasm in your local CLI:
npx @php-wasm/cli -v
PHP=7.4 npx @php-wasm/cli -v
npx @php-wasm/cli phpcbf

How can I contribute?

WordPress Playground is an open-source project and welcomes all contributors from code to design, and from documentation to triage. If the feature you need is missing, you are more than welcome to start a discussion, open an issue, and even propose a Pull Request to implement it.

Here's a few quickstart guides to get you started:

WordCamp Contributor Day

If you're participating in a WordCamp Contributor Day, you can use the following instructions to get started: WordCamp Contributor Day.

Backwards compatibility

This experimental software may break or change without a warning. Releasing a stable API is an important future milestone that will be reached once the codebase is mature enough.

Prior art

WordPress Playground forked the original PHP to WebAssembly build published in https://github.com/oraoto/pib and modified later in https://github.com/seanmorris/php-wasm.

Another strong inspiration was the Drupal in the browser demo which proved you can run non-trivial PHP software in the browser.

A worthy mention is Wasm Labs’s closed-source WordPress in the browser shared before this project was first published. There is no public repository available, but their technical overview gives a breakdown of the technical decisions that project took. WordPress Playground draws inspiration from the same PHP in the browser projects and makes similar technical choices.

Governance

WordPress Playground is a WordPress.org project started and maintained by Adam Zielinski. As Adam is on sabbatical until September 26th, Dennis Snell is the current maintainer.

Playground tools like wp-now or the interactive code block are maintained by their authors in the playground-tools monorepo.

More Repositories

1

WordPress

WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instead.
PHP
19,332
star
2

gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
JavaScript
9,873
star
3

Requests

Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.
PHP
3,572
star
4

WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
PHP
2,383
star
5

wordpress-develop

WordPress Develop, Git-ified. Synced from git://develop.git.wordpress.org/, including branches and tags! This repository is just a mirror of the WordPress subversion repository. Please include a link to a pre-existing ticket on https://core.trac.wordpress.org/ with every pull request.
PHP
2,295
star
6

gutenberg-examples

Examples for extending WordPress/Gutenberg with blocks.
JavaScript
1,189
star
7

two-factor

Two-Factor Authentication for WordPress.
PHP
724
star
8

gutenberg-starter-theme

A simple theme for testing Gutenberg.
PHP
686
star
9

dashicons

Dashicons, the WordPress admin icon font. For the official resource, please see the WordPress Developer Hub.
JavaScript
563
star
10

theme-experiments

Experimenting with themes made out of blocks.
CSS
549
star
11

book

Our book about WordPress. Version 1
520
star
12

twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
PHP
407
star
13

theme-check

Theme Check plugin
PHP
335
star
14

performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
PHP
327
star
15

twentynineteen

Twenty Nineteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
324
star
16

twentysixteen

Twenty Sixteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
323
star
17

create-block-theme

A WordPress plugin to create block themes
JavaScript
304
star
18

twentytwenty

Twenty Twenty is included in Core as of WordPress 5.3 πŸŽ‰ To report any issues, please go here: https://core.trac.wordpress.org/newticket
CSS
300
star
19

Learn

WordPress.org Learn - The canonical source for the code and content behind https://learn.WordPress.org
PHP
271
star
20

plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
PHP
246
star
21

openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Python
246
star
22

phpdoc-parser

Documentation parser powering developer.wordpress.org
PHP
237
star
23

sqlite-database-integration

Feature Plugin to add SQLite support to WordPress. Under Development.
PHP
219
star
24

twentytwentyfour

PHP
197
star
25

meta-environment

A collection of scripts that provision the official WordPress.org websites into a Varying Vagrant Vagrants installation.
PHP
190
star
26

wp-movies-demo

Demo of the Interactivity API
PHP
188
star
27

wp-feature-notifications

WP Feature Notifications - a proposal to modernise the way in which WordPress handles emails, admin notices and user notifications
PHP
188
star
28

application-passwords

PHP
183
star
29

twentyseventeen

Twenty Seventeen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
180
star
30

twentytwentyone

Ongoing development of Twenty Twenty-One, the new default WordPress theme slated for 5.6.
PHP
179
star
31

health-check

Health Check is a WordPress plugin that will perform a number of checks on your WordPress install to detect common configuration errors and known issues.
PHP
175
star
32

block-development-examples

Practical examples for building WordPress blocks and extending the Editor.
JavaScript
169
star
33

classic-editor

A plugin to restore the Classic Editor in WordPress.
PHP
160
star
34

playground-tools

TypeScript
136
star
35

secure-swfupload

A fork of the long-abandoned SWFUpload project, maintained by WordPress and others to ensure that a secure version of SWFUpload exists. Report security vulnerabilities to [email protected].
ActionScript
135
star
36

wporg-plugin-guidelines

WordPress.org Plugin Directory Guidelines
125
star
37

wordcamp.org

WordCamps are casual, locally-organized conferences covering everything related to WordPress.
PHP
124
star
38

twentytwentythree

Twenty Twenty-Three, the default WordPress theme sporting many styles that will launch with WordPress 6.1.
HTML
124
star
39

pattern-directory

The WordPress Block Pattern Directory
PHP
123
star
40

HelpHub

The WordPress user documentation portal
PHP
112
star
41

block-interactivity-experiments

⚠️ WARNING: This repository is no longer active. The development and discussions have been moved to the Gutenberg repository.
PHP
109
star
42

wordpress.org

WordPress.org Meta, Git-ified. Synced from git://meta.git.wordpress.org/ This repository is just a mirror of the WordPress Meta subversion repository. Please include a link to a pre-existing ticket on https://meta.trac.wordpress.org/ with every pull request.
PHP
107
star
43

browsehappy

PHP
102
star
44

Advanced-administration-handbook

WordPress Advanced Administration Handbook. This handbook will have the most technical, general, documentation about WordPress.
95
star
45

Security-White-Paper

The WordPress Security White Paper, available directly on the WordPress.org site at https://wordpress.org/about/security/
HTML
95
star
46

packages

Collection of JS modules and tools for WordPress development
JavaScript
87
star
47

slides

Slides: Presentations with WordPress
JavaScript
86
star
48

Documentation-Issue-Tracker

Issue Tracker for the WordPress Documentation team.
81
star
49

servehappy-resources

Third-party articles and specific tutorials on PHP upgrades.
80
star
50

community-themes

A collection of Block Themes built by the WordPress community.
HTML
80
star
51

wordpress-importer

The WordPress Importer
PHP
78
star
52

wpcs-docs

WordPress Coding Standards Docs
77
star
53

openverse-api

The Openverse API allows programmatic access to search for CC-licensed and public domain digital media.
Python
76
star
54

WP-Reasons

A public domain marketing flyer/brochure about the reasons to use WordPress, brought to you by some members of the WordPress community.
HTML
72
star
55

openverse-frontend

The gateway to the Openverse. Openverse is a search tool for CC-licensed and public domain content across the internet.
Vue
72
star
56

hosting-handbook

WordPress Hosting Team Handbook
PHP
71
star
57

revisions-extended

PHP
70
star
58

data-liberation

69
star
59

wp-lazy-loading

Feature plugin for testing and experimenting with the "loading" HTML attribute.
PHP
68
star
60

phpunit-test-runner

PHP
65
star
61

wporg-main-2022

A block-based child theme for WordPress.org, plus local environment
PHP
64
star
62

wp-plugin-dependencies

WordPress Feature Project: Plugin Dependencies
PHP
63
star
63

wporg-code-analysis

An experiment.
PHP
62
star
64

wpdev-docker-images

Docker images for use with the Core local development environment.
Dockerfile
61
star
65

wporg-developer

WordPress.org Developer theme
PHP
61
star
66

wporg-mu-plugins

Development of the Global Header and other mu-plugins used on WordPress.org.
PHP
60
star
67

openverse-catalog

Identifies and collects data on cc-licensed content across web crawl data and public apis.
Python
57
star
68

wp-autoupdates

Feature plugin building a UI for opting-in to plugin, theme, and core auto-updates.
PHP
56
star
69

servehappy

Information page about PHP versions and updates, to be used through the WordPress.org project.
53
star
70

grunt-patch-wordpress

Patch Trac based projects
JavaScript
49
star
71

WordPress-Documentation-Style-Guide

Style Guide for WordPress documentation.
47
star
72

design-experiments

A simple plugin for WP-Admin design experiments. Brought to you by the WordPress Design Team.
CSS
47
star
73

blueprints

Blueprints gallery and examples
Python
46
star
74

press-this

Press This is a little tool that lets you grab bits of the web and create new posts with ease. It will even allow you to choose from images or videos included on the page and use them in your post. Use Press This as a quick and lightweight way to highlight another page on the web.
CSS
45
star
75

wp20-book

Our book about WordPress. Version 2
43
star
76

plugin-check-action

Test your WordPress plugin with Plugin Check
TypeScript
42
star
77

five-for-the-future

Plugins and themes for the Five for the Future subsite
PHP
39
star
78

plugin-check-legacy

Work in progress of a "Plugin Check" plugin, this is in development and is not final.
PHP
39
star
79

css-audit

JavaScript
38
star
80

better-code-editing

[βœ… Merged into 4.9-alpha] Better Code Editing WordPress plugin
CSS
38
star
81

wporg-two-factor

2FA for WordPress.org accounts
JavaScript
37
star
82

developer-blog-content

In this GitHub space, WordPress team coordinate content to be published on the Developer Blog. Discussion and montly meetings (first Thu) in WP Slack #core-dev-blog
37
star
83

meeting-calendar

The plugin powering https://make.wordpress.org/meetings/
PHP
35
star
84

block-theme-examples

A repository of feature examples for block themes.
PHP
34
star
85

rollback-update-failure

Feature plugin to test zip rollback of plugin/theme update failures.
PHP
33
star
86

wporg-news-2021

The WordPress.org News Theme
SCSS
31
star
87

blueprints-library

PHP
30
star
88

theme-review-action

JavaScript
28
star
89

phpunit-test-reporter

PHP
28
star
90

Marketing-Team

The central repository for the WordPress Marketing Team
27
star
91

block-directory

Block library: Timeline and plan: https://make.wordpress.org/design/2019/04/26/block-library-installing-blocks-from-within-gutenberg/
27
star
92

contributor-day-handbook

25
star
93

gutenberg.run

Gutenberg live branch preview provisioning service
JavaScript
25
star
94

openverse-browser-extension

A cross-browser extension that lets you search, filter, and use openly-licensed images.
JavaScript
21
star
95

google-fonts-to-wordpress-collection

Gets the Google fonts collection and transform it to a WordPress font library collection, including SVG previews
JavaScript
19
star
96

wporg-showcase-2022

The official theme of the WordPress.org showcase.
PHP
19
star
97

spain-handbook

Manuales de la Comunidad de WordPress EspaΓ±a (Handbook)
18
star
98

wporg-parent-2021

SCSS
17
star
99

classic-widgets

A plugin to restore the Classic Widgets in WordPress.
PHP
17
star
100

Community

WordPress Community Team Projects and Plans | https://make.wordpress.org/community/
16
star