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

GenericStep<FileResource, DirectoryResource>: ActivatePluginStep | ActivateThemeStep | CpStep | DefineWpConfigConstsStep | DefineSiteUrlStep | EnableMultisiteStep | ImportWxrStep<FileResource> | ImportThemeStarterContentStep | ImportWordPressFilesStep<FileResource> | InstallPluginStep<FileResource, DirectoryResource> | InstallThemeStep<FileResource, DirectoryResource> | LoginStep | MkdirStep | MvStep | ResetDataStep | RequestStep | RmStep | RmdirStep | RunPHPStep | RunPHPWithOptionsStep | RunWpInstallationWizardStep | RunSqlStep<FileResource> | SetSiteOptionsStep | UnzipStep<FileResource> | UpdateUserMetaStep | WriteFileStep<FileResource> | WriteFilesStep<DirectoryResource> | WPCLIStep | SetSiteLanguageStep

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


Type parameters

  • FileResource
  • DirectoryResource

HTTPMethod

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

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 Playground. Under the hood, this function sets the PLAYGROUND_AUTO_LOGIN_AS_USER constant. The 0-auto-login.php mu-plugin uses that constant to log in the user on the first load. This step depends on the @wp-playground/wordpress package because the plugin is located in and loaded automatically by the @wp-playground/wordpress package.

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

Type declaration

  • optionalpassword?: string
    @deprecated

    The password field is deprecated and will be removed in a future version. Only the username field is required for user authentication.

  • step: login
  • optionalusername?: string

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

OnStepCompleted

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

Type declaration

PHPConstants

PHPConstants: Record<string, string | boolean | number>

PHPRequestHandlerConfiguration

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

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

Step: GenericStep<FileReference, DirectoryReference>

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: LimitedPHPApi | Remote<LimitedPHPApi>

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, git:directory] = ...

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.