Back to Dagger

Directory

docs/static/reference/php/Dagger/Directory.html

0.20.717.8 KB
Original Source

Directory

class Directory extends AbstractObject implements IdAble

A directory.

Properties

| | $lastQuery | | from AbstractObject |

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

from AbstractObject

null|array|string|int|float|bool

queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

from AbstractObject

GitRepository

asGit()

Converts this directory to a local git repository

Module

asModule(string|null $sourceRootPath = '.')

Load the directory as a Dagger module source

ModuleSource

asModuleSource(string|null $sourceRootPath = '.')

Load the directory as a Dagger module source

Changeset

changes(Directory $from)

Return the difference between this directory and another directory, typically an older snapshot.

Directory

chown(string $path, string $owner)

Change the owner of the directory contents recursively.

Directory

diff(Directory $other)

Return the difference between this directory and an another directory. The difference is encoded as a directory.

string

digest()

Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

Directory

directory(string $path)

Retrieves a directory at the given path.

Container

dockerBuild(string|null $dockerfile = 'Dockerfile', Platform|null $platform = null, array|null $buildArgs = null, string|null $target = '', array|null $secrets = null, bool|null $noInit = false, Socket|null $ssh = null)

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.

array

entries(string|null $path = null)

Returns a list of files and directories at the given path.

bool

exists(string $path, ExistsType|null $expectedType = null, bool|null $doNotFollowSymlinks = false)

check if a file or directory exists

string

export(string $path, bool|null $wipe = false)

Writes the contents of the directory to a path on the host.

File

file(string $path)

Retrieve a file at the given path.

Directory

filter(array|null $exclude = null, array|null $include = null, bool|null $gitignore = false)

Return a snapshot with some paths included or excluded

string

findUp(string $name, string $start)

Search up the directory tree for a file or directory, and return its path. If no match, return null

array

glob(string $pattern)

Returns a list of files and directories that matche the given pattern.

AbstractId

id()

A unique identifier for this Directory.

string

name()

Returns the name of the directory.

array

search(string $pattern, array|null $paths = null, array|null $globs = null, bool|null $literal = false, bool|null $multiline = false, bool|null $dotall = false, bool|null $insensitive = false, bool|null $skipIgnored = false, bool|null $skipHidden = false, bool|null $filesOnly = false, int|null $limit = null)

Searches for content matching the given regular expression or literal string.

Stat

stat(string $path, bool|null $doNotFollowSymlinks = false)

Return file status

DirectoryId

sync()

Force evaluation in the engine.

Directory

terminal(Container|null $container = null, array|null $cmd = null, bool|null $experimentalPrivilegedNesting = false, bool|null $insecureRootCapabilities = false)

Opens an interactive terminal in new container with this directory mounted inside.

Directory

withChanges(Changeset $changes)

Return a directory with changes from another directory applied to it.

Directory

withDirectory(string $path, Directory $source, array|null $exclude = null, array|null $include = null, bool|null $gitignore = false, string|null $owner = '')

Return a snapshot with a directory added

Directory

withError(string $err)

Raise an error.

Directory

withFile(string $path, File $source, int|null $permissions = null, string|null $owner = '')

Retrieves this directory plus the contents of the given file copied to the given path.

Directory

withFiles(string $path, array $sources, int|null $permissions = null)

Retrieves this directory plus the contents of the given files copied to the given path.

Directory

withNewDirectory(string $path, int|null $permissions = 420)

Retrieves this directory plus a new directory created at the given path.

Directory

withNewFile(string $path, string $contents, int|null $permissions = 420)

Return a snapshot with a new file added

Directory

withPatch(string $patch)

Retrieves this directory with the given Git-compatible patch applied.

Directory

withPatchFile(File $patch)

Retrieves this directory with the given Git-compatible patch file applied.

Directory

withSymlink(string $target, string $linkName)

Return a snapshot with a symlink

Directory

withTimestamps(int $timestamp)

Retrieves this directory with all file/dir timestamps set to the given time.

Directory

withoutDirectory(string $path)

Return a snapshot with a subdirectory removed

Directory

withoutFile(string $path)

Return a snapshot with a file removed

Directory

withoutFiles(array $paths)

Return a snapshot with files removed

Details

in AbstractObject at line 13 __construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

| AbstractClient | $client | | | QueryBuilderChain | $queryBuilderChain | |

in AbstractObject at line 19 protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

| QueryBuilder | $leafQueryBuilder | | | string | $leafKey | |

Return Value

| null|array|string|int|float|bool | |

at line 19 GitRepository asGit()

Converts this directory to a local git repository

Return Value

| GitRepository | |

at line 28 Module asModule(string|null $sourceRootPath = '.')

Load the directory as a Dagger module source

Parameters

| string|null | $sourceRootPath | |

Return Value

| Module | |

at line 40 ModuleSource asModuleSource(string|null $sourceRootPath = '.')

Load the directory as a Dagger module source

Parameters

| string|null | $sourceRootPath | |

Return Value

| ModuleSource | |

at line 54 Changeset changes(Directory $from)

Return the difference between this directory and another directory, typically an older snapshot.

The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories.

Parameters

| Directory | $from | |

Return Value

| Changeset | |

at line 64 Directory chown(string $path, string $owner)

Change the owner of the directory contents recursively.

Parameters

| string | $path | | | string | $owner | |

Return Value

| Directory | |

at line 75 Directory diff(Directory $other)

Return the difference between this directory and an another directory. The difference is encoded as a directory.

Parameters

| Directory | $other | |

Return Value

| Directory | |

at line 85 string digest()

Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

Return Value

| string | |

at line 94 Directory directory(string $path)

Retrieves a directory at the given path.

Parameters

| string | $path | |

Return Value

| Directory | |

at line 104 Container dockerBuild(string|null $dockerfile = 'Dockerfile', Platform|null $platform = null, array|null $buildArgs = null, string|null $target = '', array|null $secrets = null, bool|null $noInit = false, Socket|null $ssh = null)

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.

Parameters

| string|null | $dockerfile | | | Platform|null | $platform | | | array|null | $buildArgs | | | string|null | $target | | | array|null | $secrets | | | bool|null | $noInit | | | Socket|null | $ssh | |

Return Value

| Container | |

at line 141 array entries(string|null $path = null)

Returns a list of files and directories at the given path.

Parameters

| string|null | $path | |

Return Value

| array | |

check if a file or directory exists

Parameters

| string | $path | | | ExistsType|null | $expectedType | | | bool|null | $doNotFollowSymlinks | |

Return Value

| bool | |

at line 169 string export(string $path, bool|null $wipe = false)

Writes the contents of the directory to a path on the host.

Parameters

| string | $path | | | bool|null | $wipe | |

Return Value

| string | |

at line 182 File file(string $path)

Retrieve a file at the given path.

Parameters

| string | $path | |

Return Value

| File | |

at line 192 Directory filter(array|null $exclude = null, array|null $include = null, bool|null $gitignore = false)

Return a snapshot with some paths included or excluded

Parameters

| array|null | $exclude | | | array|null | $include | | | bool|null | $gitignore | |

Return Value

| Directory | |

at line 210 string findUp(string $name, string $start)

Search up the directory tree for a file or directory, and return its path. If no match, return null

Parameters

| string | $name | | | string | $start | |

Return Value

| string | |

at line 221 array glob(string $pattern)

Returns a list of files and directories that matche the given pattern.

Parameters

| string | $pattern | |

Return Value

| array | |

at line 231 AbstractId id()

A unique identifier for this Directory.

Return Value

| AbstractId | |

at line 240 string name()

Returns the name of the directory.

Return Value

| string | |

at line 251 array search(string $pattern, array|null $paths = null, array|null $globs = null, bool|null $literal = false, bool|null $multiline = false, bool|null $dotall = false, bool|null $insensitive = false, bool|null $skipIgnored = false, bool|null $skipHidden = false, bool|null $filesOnly = false, int|null $limit = null)

Searches for content matching the given regular expression or literal string.

Uses Rust regex syntax; escape literal ., [,], {, }, | with backslashes.

Parameters

| string | $pattern | | | array|null | $paths | | | array|null | $globs | | | bool|null | $literal | | | bool|null | $multiline | | | bool|null | $dotall | | | bool|null | $insensitive | | | bool|null | $skipIgnored | | | bool|null | $skipHidden | | | bool|null | $filesOnly | | | int|null | $limit | |

Return Value

| array | |

Return file status

Parameters

| string | $path | | | bool|null | $doNotFollowSymlinks | |

Return Value

| Stat | |

at line 315 DirectoryId sync()

Force evaluation in the engine.

Return Value

| DirectoryId | |

at line 324 Directory terminal(Container|null $container = null, array|null $cmd = null, bool|null $experimentalPrivilegedNesting = false, bool|null $insecureRootCapabilities = false)

Opens an interactive terminal in new container with this directory mounted inside.

Parameters

| Container|null | $container | | | array|null | $cmd | | | bool|null | $experimentalPrivilegedNesting | | | bool|null | $insecureRootCapabilities | |

Return Value

| Directory | |

at line 349 Directory withChanges(Changeset $changes)

Return a directory with changes from another directory applied to it.

Parameters

| Changeset | $changes | |

Return Value

| Directory | |

at line 359 Directory withDirectory(string $path, Directory $source, array|null $exclude = null, array|null $include = null, bool|null $gitignore = false, string|null $owner = '')

Return a snapshot with a directory added

Parameters

| string | $path | | | Directory | $source | | | array|null | $exclude | | | array|null | $include | | | bool|null | $gitignore | | | string|null | $owner | |

Return Value

| Directory | |

at line 388 Directory withError(string $err)

Raise an error.

Parameters

| string | $err | |

Return Value

| Directory | |

at line 398 Directory withFile(string $path, File $source, int|null $permissions = null, string|null $owner = '')

Retrieves this directory plus the contents of the given file copied to the given path.

Parameters

| string | $path | | | File | $source | | | int|null | $permissions | | | string|null | $owner | |

Return Value

| Directory | |

at line 419 Directory withFiles(string $path, array $sources, int|null $permissions = null)

Retrieves this directory plus the contents of the given files copied to the given path.

Parameters

| string | $path | | | array | $sources | | | int|null | $permissions | |

Return Value

| Directory | |

at line 433 Directory withNewDirectory(string $path, int|null $permissions = 420)

Retrieves this directory plus a new directory created at the given path.

Parameters

| string | $path | | | int|null | $permissions | |

Return Value

| Directory | |

at line 446 Directory withNewFile(string $path, string $contents, int|null $permissions = 420)

Return a snapshot with a new file added

Parameters

| string | $path | | | string | $contents | | | int|null | $permissions | |

Return Value

| Directory | |

at line 460 Directory withPatch(string $patch)

Retrieves this directory with the given Git-compatible patch applied.

Parameters

| string | $patch | |

Return Value

| Directory | |

at line 470 Directory withPatchFile(File $patch)

Retrieves this directory with the given Git-compatible patch file applied.

Parameters

| File | $patch | |

Return Value

| Directory | |

Return a snapshot with a symlink

Parameters

| string | $target | | | string | $linkName | |

Return Value

| Directory | |

at line 491 Directory withTimestamps(int $timestamp)

Retrieves this directory with all file/dir timestamps set to the given time.

Parameters

| int | $timestamp | |

Return Value

| Directory | |

at line 501 Directory withoutDirectory(string $path)

Return a snapshot with a subdirectory removed

Parameters

| string | $path | |

Return Value

| Directory | |

at line 511 Directory withoutFile(string $path)

Return a snapshot with a file removed

Parameters

| string | $path | |

Return Value

| Directory | |

at line 521 Directory withoutFiles(array $paths)

Return a snapshot with files removed

Parameters

| array | $paths | |

Return Value

| Directory | |

Generated by Doctum, a API Documentation generator and fork of Sami.