php
PHP programming language module.
Example (Composer)
no available example in current languagefunc (m *Examples) Php_Composer(ctx context.Context) error {
_, err := dag.Php().
WithComposer(). // This is optional: will be installed automatically
WithComposerPackage("phpstan/phpstan").
Container().
WithExec([]string{"phpstan", "analyse", "--help"}).
Sync(ctx)
return err
}no available example in current languageno available example in current languageExample (Extension)
no available example in current languagefunc (m *Examples) Php_Extension(ctx context.Context) error {
_, err := dag.Php().
WithExtensionInstaller(). // This is optional: will be installed automatically
WithExtension("zip").
Container().
WithExec([]string{"php", "-m"}).
Sync(ctx)
return err
}no available example in current languageno available example in current languageInstallation
dagger install github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5Entrypoint
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "latest" | Version (image tag) to use from the official image repository as a base container. |
| container | Container | - | Custom container to use as a base container. Takes precedence over version. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
func (m *MyModule) Example() *dagger.Php {
return dag.
Php()
}@function
def example() -> dagger.Php:
return (
dag.php()
)@func()
example(): Php {
return dag
.php()
}Types
Php 🔗
container() 🔗
Return Type
Container ! Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
containerfunc (m *MyModule) Example() *dagger.Container {
return dag.
Php().
Container()
}@function
def example() -> dagger.Container:
return (
dag.php()
.container()
)@func()
example(): Container {
return dag
.php()
.container()
}withComposer() 🔗
Install Composer.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "latest" | Version (image tag) to use from the official image repository. |
| binary | File | - | Custom binary to use. Takes precedence over version. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-composerfunc (m *MyModule) Example() *dagger.Php {
return dag.
Php().
Withcomposer()
}@function
def example() -> dagger.Php:
return (
dag.php()
.withcomposer()
)@func()
example(): Php {
return dag
.php()
.withComposer()
}withComposerCache() 🔗
Mount a cache volume for Composer cache.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| cache | CacheVolume ! | - | No description provided |
| source | Directory | - | Identifier of the directory to use as the cache volume’s root. |
| sharing | Enum | - | Sharing mode of the cache volume. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-composer-cache --cache VOLUME_NAMEfunc (m *MyModule) Example(cache *dagger.CacheVolume) *dagger.Php {
return dag.
Php().
Withcomposercache(cache)
}@function
def example(cache: dagger.CacheVolume) -> dagger.Php:
return (
dag.php()
.withcomposercache(cache)
)@func()
example(cache: CacheVolume): Php {
return dag
.php()
.withComposerCache(cache)
}withComposerPackage() 🔗
Install a Composer package globally.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-composer-package --name stringfunc (m *MyModule) Example(name string) *dagger.Php {
return dag.
Php().
Withcomposerpackage(name)
}@function
def example(name: str) -> dagger.Php:
return (
dag.php()
.withcomposerpackage(name)
)@func()
example(name: string): Php {
return dag
.php()
.withComposerPackage(name)
}withComposerPackages() 🔗
Install a list of Composer packages globally.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | [String ! ] ! | - | No description provided |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-composer-packages --name string1 --name string2func (m *MyModule) Example(name []string) *dagger.Php {
return dag.
Php().
Withcomposerpackages(name)
}@function
def example(name: List[str]) -> dagger.Php:
return (
dag.php()
.withcomposerpackages(name)
)@func()
example(name: string[]): Php {
return dag
.php()
.withComposerPackages(name)
}withExtension() 🔗
Install an extension using docker-php-extension-installer.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | No description provided |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-extension --name stringfunc (m *MyModule) Example(name string) *dagger.Php {
return dag.
Php().
Withextension(name)
}@function
def example(name: str) -> dagger.Php:
return (
dag.php()
.withextension(name)
)@func()
example(name: string): Php {
return dag
.php()
.withExtension(name)
}withExtensionInstaller() 🔗
Install docker-php-extension-installer.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "latest" | Version to use from the official repository. |
| binary | File | - | Custom binary to use. Takes precedence over version. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-extension-installerfunc (m *MyModule) Example() *dagger.Php {
return dag.
Php().
Withextensioninstaller()
}@function
def example() -> dagger.Php:
return (
dag.php()
.withextensioninstaller()
)@func()
example(): Php {
return dag
.php()
.withExtensionInstaller()
}withExtensions() 🔗
Install a list of extensions using docker-php-extension-installer.
Return Type
Php !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | [String ! ] ! | - | No description provided |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-extensions --name string1 --name string2func (m *MyModule) Example(name []string) *dagger.Php {
return dag.
Php().
Withextensions(name)
}@function
def example(name: List[str]) -> dagger.Php:
return (
dag.php()
.withextensions(name)
)@func()
example(name: string[]): Php {
return dag
.php()
.withExtensions(name)
}withSource() 🔗
Mount a source directory.
Return Type
WithSource !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | Source directory to mount. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-source --source DIR_PATHfunc (m *MyModule) Example(source *dagger.Directory) *dagger.PhpWithSource {
return dag.
Php().
Withsource(source)
}@function
def example(source: dagger.Directory) -> dagger.PhpWithSource:
return (
dag.php()
.withsource(source)
)@func()
example(source: Directory): PhpWithSource {
return dag
.php()
.withSource(source)
}WithSource 🔗
source() 🔗
Return Type
Directory ! Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-source --source DIR_PATH \
sourcefunc (m *MyModule) Example(source *dagger.Directory) *dagger.Directory {
return dag.
Php().
Withsource(source).
Source()
}@function
def example(source: dagger.Directory) -> dagger.Directory:
return (
dag.php()
.withsource(source)
.source()
)@func()
example(source: Directory): Directory {
return dag
.php()
.withSource(source)
.source()
}container() 🔗
Return Type
Container ! Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-source --source DIR_PATH \
containerfunc (m *MyModule) Example(source *dagger.Directory) *dagger.Container {
return dag.
Php().
Withsource(source).
Container()
}@function
def example(source: dagger.Directory) -> dagger.Container:
return (
dag.php()
.withsource(source)
.container()
)@func()
example(source: Directory): Container {
return dag
.php()
.withSource(source)
.container()
}withComposerInstall() 🔗
Make sure Composer dependencies are installed.
Return Type
WithSource ! Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-source --source DIR_PATH \
with-composer-installfunc (m *MyModule) Example(source *dagger.Directory) *dagger.PhpWithSource {
return dag.
Php().
Withsource(source).
Withcomposerinstall()
}@function
def example(source: dagger.Directory) -> dagger.PhpWithSource:
return (
dag.php()
.withsource(source)
.withcomposerinstall()
)@func()
example(source: Directory): PhpWithSource {
return dag
.php()
.withSource(source)
.withComposerInstall()
}withExec() 🔗
Run a command.
Return Type
WithSource !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| args | [String ! ] ! | - | Arguments to pass to the command. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@f71f2fb59d9cd4a61e5e0520f247d2aea0854df5 call \
with-source --source DIR_PATH \
with-exec --args string1 --args string2func (m *MyModule) Example(source *dagger.Directory, args []string) *dagger.PhpWithSource {
return dag.
Php().
Withsource(source).
Withexec(args)
}@function
def example(source: dagger.Directory, args: List[str]) -> dagger.PhpWithSource:
return (
dag.php()
.withsource(source)
.withexec(args)
)@func()
example(source: Directory, args: string[]): PhpWithSource {
return dag
.php()
.withSource(source)
.withExec(args)
}