Skip to main content

@wp-playground/client

Index

Classes

Functions

Interfaces

Type Aliases

Variables

Type Aliases

CompiledStep

CompiledStep: (php: UniversalPHP) => Promise<void> | void

Type declaration

CorePluginReference

CorePluginReference: { resource: wordpress.org/plugins; slug: string }

Type declaration

  • resource: wordpress.org/plugins

    Identifies the file resource as a WordPress Core plugin

  • slug: string

    The slug of the WordPress Core plugin

CoreThemeReference

CoreThemeReference: { resource: wordpress.org/themes; slug: string }

Type declaration

  • resource: wordpress.org/themes

    Identifies the file resource as a WordPress Core theme

  • slug: string

    The slug of the WordPress Core theme

FileReference

GenericStep

If you add a step here, make sure to also add it to the exports below.


Type parameters

  • Resource

HTTPMethod

HTTPMethod: GET | POST | HEAD | OPTIONS | PATCH | PUT | DELETE

IsomorphicRemotePHP

IsomorphicRemotePHP: Remote<Omit<IsomorphicLocalPHP, setSapiName | setPhpIniEntry | setPhpIniPath>>

The omited methods must either be called synchronously before the PHP internal state is initialized, or with a complex argument that can’t be serialized over a remote connection. Therefeore, they don’t make sense in a remote PHP instance.

LiteralReference

LiteralReference: { contents: string | Uint8Array; name: string; resource: literal }

Type declaration

  • contents: string | Uint8Array

    The contents of the file

  • name: string

    The name of the file

  • resource: literal

    Identifies the file resource as a literal file

LoginStep

LoginStep: { password?: string; step: login; username?: string }

Logs in to the Playground. Under the hood, this function submits the wp-login.php form just like a user would.

@hasRunnableExample
@example
<code>
{
"step": "login",
"username": "admin",
"password": "password"
}
</code>

Type declaration

  • optionalpassword?: string

    The password to log in with. Defaults to ‘password’.

  • step: login
  • optionalusername?: string

    The user to log in as. Defaults to ‘admin’.

OnStepCompleted

OnStepCompleted: (output: any, step: StepDefinition) => any

Type declaration

PHPRequestHandlerConfiguration

PHPRequestHandlerConfiguration<PHP>: BaseConfiguration & ({ processManager: PHPProcessManager<PHP> } | { maxPhpInstances?: number; phpFactory: (requestHandler: PHPRequestHandlerFactoryArgs<PHP>) => Promise<PHP> })

Type parameters

  • PHP: BasePHP

PHPRequestHeaders

PHPRequestHeaders: Record<string, string>

RuntimeType

RuntimeType: NODE | WEB | WORKER

SetSiteOptionsStep

SetSiteOptionsStep: { options: Record<string, unknown>; step: setSiteOptions }

Sets site options. This is equivalent to calling update_option for each option in the options object.

@hasRunnableExample
@example
<code>
{
"step": "setSiteOptions",
"options": {
"blogname": "My Blog",
"blogdescription": "A great blog"
}
}
</code>

Type declaration

  • options: Record<string, unknown>

    The options to set on the site.

  • step: setSiteOptions

    The name of the step. Must be “setSiteOptions”.

Step

StepDefinition

StepDefinition: Step & { progress?: { caption?: string; weight?: number } }

StepHandler

StepHandler<S, Return>: (php: UniversalPHP, args: Omit<S, step>, progressArgs?: StepProgress) => Return

Type parameters

Type declaration

StepProgress

StepProgress: { initialCaption?: string; tracker: ProgressTracker }

Progress reporting details.


Type declaration

  • optionalinitialCaption?: string
  • tracker: ProgressTracker

SupportedPHPVersion

SupportedPHPVersion: typeof SupportedPHPVersions[number]

UniversalPHP

UniversalPHP: IsomorphicLocalPHP | IsomorphicRemotePHP

UrlReference

UrlReference: { caption?: string; resource: url; url: string }

Type declaration

  • optionalcaption?: string

    Optional caption for displaying a progress message

  • resource: url

    Identifies the file resource as a URL

  • url: string

    The URL of the file

VFSReference

VFSReference: { path: string; resource: vfs }

Type declaration

  • path: string

    The path to the file in the VFS

  • resource: vfs

    Identifies the file resource as Virtual File System (VFS)

Variables

constLatestSupportedPHPVersion

LatestSupportedPHPVersion: 8.3 = ...

constResourceTypes

ResourceTypes: readonly [vfs, literal, wordpress.org/themes, wordpress.org/plugins, url] = ...

constSupportedPHPVersions

SupportedPHPVersions: readonly [8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0] = ...

constSupportedPHPVersionsList

SupportedPHPVersionsList: string[] = ...

constwpContentFilesExcludedFromExport

wpContentFilesExcludedFromExport: string[] = ...

Used by the export step to exclude the Playground-specific files from the zip file. Keep it in sync with the list of files created by WordPressPatcher.