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@v0.1.0Entrypoint
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. |
Example
dagger -m github.com/sagikazarmark/daggerverse/php@0af084118b214771286c548a63742219cf95d398 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 🔗
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@0af084118b214771286c548a63742219cf95d398 call \
with-composerfunc (m *MyModule) Example() *dagger.Php {
return dag.
Php().
WithComposer()
}@function
def example() -> dagger.Php:
return (
dag.php()
.with_composer()
)@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@0af084118b214771286c548a63742219cf95d398 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()
.with_composer_cache(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@0af084118b214771286c548a63742219cf95d398 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()
.with_composer_package(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@0af084118b214771286c548a63742219cf95d398 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()
.with_composer_packages(name)
)@func()
example(name: string[]): Php {
return dag
.php()
.withComposerPackages(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@0af084118b214771286c548a63742219cf95d398 call \
with-extension-installerfunc (m *MyModule) Example() *dagger.Php {
return dag.
Php().
WithExtensionInstaller()
}@function
def example() -> dagger.Php:
return (
dag.php()
.with_extension_installer()
)@func()
example(): Php {
return dag
.php()
.withExtensionInstaller()
}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@0af084118b214771286c548a63742219cf95d398 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()
.with_extension(name)
)@func()
example(name: string): Php {
return dag
.php()
.withExtension(name)
}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@0af084118b214771286c548a63742219cf95d398 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()
.with_extensions(name)
)@func()
example(name: string[]): Php {
return dag
.php()
.withExtensions(name)
}container() 🔗
Return Type
Container ! Example
dagger -m github.com/sagikazarmark/daggerverse/php@0af084118b214771286c548a63742219cf95d398 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()
}