Skip to main content

writeFiles

Callable

  • writeFiles(php: UniversalPHP, root: string, newFiles: FileTree, options?: WriteFilesOptions): Promise<void>

  • Writes multiple files to a specified directory in the Playground filesystem.

    Every key in the file tree must resolve inside the target directory. Paths are validated before any existing files are removed so an invalid nested entry cannot leave the target directory half-cleared.

    @example

    Parameters

    • php: UniversalPHP

      The Playground filesystem to write to.

    • root: string

      The directory that receives the file tree.

    • newFiles: FileTree

      Files and nested directories keyed by relative paths.

    • options: WriteFilesOptions = {}

      Write behavior such as clearing the root first.

    Returns Promise<void>