Dagger
Search

php

PHP programming language module.

Example (Composer)
no available example in current language
func (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 language
no available example in current language
Example (Extension)
no available example in current language
func (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 language
no available example in current language

Installation

dagger install github.com/sagikazarmark/daggerverse/php@v0.2.0

Entrypoint

Return Type
Php !
Arguments
NameTypeDefault ValueDescription
versionString "latest"Version (image tag) to use from the official image repository as a base container.
containerContainer -Custom container to use as a base container. Takes precedence over version.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
func (m *myModule) example() *Php  {
	return dag.
			Php()
}
@function
def example() -> dag.Php:
	return (
		dag.php()
	)
@func()
example(): Php {
	return dag
		.php()
}

Types

Php 🔗

withComposer() 🔗

Install Composer.

Return Type
Php !
Arguments
NameTypeDefault ValueDescription
versionString "latest"Version (image tag) to use from the official image repository.
binaryFile -Custom binary to use. Takes precedence over version.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-composer
func (m *myModule) example() *Php  {
	return dag.
			Php().
			WithComposer()
}
@function
def example() -> dag.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
NameTypeDefault ValueDescription
cacheCacheVolume !-No description provided
sourceDirectory -Identifier of the directory to use as the cache volume's root.
sharingEnum -Sharing mode of the cache volume.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-composer-cache --cache VOLUME_NAME
func (m *myModule) example(cache *CacheVolume) *Php  {
	return dag.
			Php().
			WithComposerCache(cache)
}
@function
def example(cache: dagger.CacheVolume) -> dag.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
NameTypeDefault ValueDescription
nameString !-No description provided
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-composer-package --name string
func (m *myModule) example(name string) *Php  {
	return dag.
			Php().
			WithComposerPackage(name)
}
@function
def example(name: str) -> dag.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
NameTypeDefault ValueDescription
name[String ! ] !-No description provided
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-composer-packages --name string1 --name string2
func (m *myModule) example(name []string) *Php  {
	return dag.
			Php().
			WithComposerPackages(name)
}
@function
def example(name: List[str]) -> dag.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
NameTypeDefault ValueDescription
versionString "latest"Version to use from the official repository.
binaryFile -Custom binary to use. Takes precedence over version.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-extension-installer
func (m *myModule) example() *Php  {
	return dag.
			Php().
			WithExtensionInstaller()
}
@function
def example() -> dag.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
NameTypeDefault ValueDescription
nameString !-No description provided
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-extension --name string
func (m *myModule) example(name string) *Php  {
	return dag.
			Php().
			WithExtension(name)
}
@function
def example(name: str) -> dag.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
NameTypeDefault ValueDescription
name[String ! ] !-No description provided
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-extensions --name string1 --name string2
func (m *myModule) example(name []string) *Php  {
	return dag.
			Php().
			WithExtensions(name)
}
@function
def example(name: List[str]) -> dag.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@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 container
func (m *myModule) example() *Container  {
	return dag.
			Php().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.php()
		.container()
	)
@func()
example(): Container {
	return dag
		.php()
		.container()
}

withSource() 🔗

Mount a source directory.

Return Type
WithSource !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-Source directory to mount.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-source --source DIR_PATH
func (m *myModule) example(source *Directory) *PhpWithSource  {
	return dag.
			Php().
			WithSource(source)
}
@function
def example(source: dagger.Directory) -> dag.PhpWithSource:
	return (
		dag.php()
		.with_source(source)
	)
@func()
example(source: Directory): PhpWithSource {
	return dag
		.php()
		.withSource(source)
}

WithSource 🔗

source() 🔗

Return Type
Directory !
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-source --source DIR_PATH \
 source
func (m *myModule) example(source *Directory) *Directory  {
	return dag.
			Php().
			WithSource(source).
			Source()
}
@function
def example(source: dagger.Directory) -> dagger.Directory:
	return (
		dag.php()
		.with_source(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@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-source --source DIR_PATH \
 container
func (m *myModule) example(source *Directory) *Container  {
	return dag.
			Php().
			WithSource(source).
			Container()
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.php()
		.with_source(source)
		.container()
	)
@func()
example(source: Directory): Container {
	return dag
		.php()
		.withSource(source)
		.container()
}

withExec() 🔗

Run a command.

Return Type
WithSource !
Arguments
NameTypeDefault ValueDescription
args[String ! ] !-Arguments to pass to the command.
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-source --source DIR_PATH \
 with-exec --args string1 --args string2
func (m *myModule) example(source *Directory, args []string) *PhpWithSource  {
	return dag.
			Php().
			WithSource(source).
			WithExec(args)
}
@function
def example(source: dagger.Directory, args: List[str]) -> dag.PhpWithSource:
	return (
		dag.php()
		.with_source(source)
		.with_exec(args)
	)
@func()
example(source: Directory, args: string[]): PhpWithSource {
	return dag
		.php()
		.withSource(source)
		.withExec(args)
}

withComposerInstall() 🔗

Make sure Composer dependencies are installed.

Return Type
WithSource !
Example
dagger -m github.com/sagikazarmark/daggerverse/php@77ecc6dfd82c8d8c1cc37a7f97b719203cfa9cf0 call \
 with-source --source DIR_PATH \
 with-composer-install
func (m *myModule) example(source *Directory) *PhpWithSource  {
	return dag.
			Php().
			WithSource(source).
			WithComposerInstall()
}
@function
def example(source: dagger.Directory) -> dag.PhpWithSource:
	return (
		dag.php()
		.with_source(source)
		.with_composer_install()
	)
@func()
example(source: Directory): PhpWithSource {
	return dag
		.php()
		.withSource(source)
		.withComposerInstall()
}