Download the PHP package tiny-blocks/docker-container without Composer

On this page you can find all versions of the php package tiny-blocks/docker-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package docker-container

Docker container

Overview

The DockerContainer library provides an interface and implementations to manage Docker containers programmatically. It simplifies the creation, execution, and interaction with containers, such as adding network configurations, mapping ports, setting environment variables, and executing commands inside containers. Designed specifically to support unit tests and integration tests, the library enables developers to simulate and manage containerized environments with minimal effort, ensuring a seamless testing workflow.

Installation

How to use

Creating a container

Creates a container from a specified image and optionally a name. The from method can be used to initialize a new container instance with an image and an optional name for identification.

Running a container

The run method starts a container. Optionally, it allows you to execute commands within the container after it has started and define a condition to wait for using a ContainerWaitAfterStarted instance.

Example with no commands or conditions:

Example with commands only:

Example with commands and a wait condition:

Running a container if it doesn't exist

The runIfNotExists method starts a container only if it doesn't already exist. Optionally, it allows you to execute commands within the container after it has started and define a condition to wait for using a ContainerWaitAfterStarted instance.

Example with commands only:

Example with commands and a wait condition:

Setting network

The withNetwork method connects the container to a specified Docker network by name, allowing you to define the network configuration the container will use.

Setting port mappings

Maps ports between the host and the container. The withPortMapping method maps a port from the host to a port inside the container.

Setting volumes mappings

Maps a volume from the host to the container. The withVolumeMapping method allows you to link a directory from the host to the container.

Setting environment variables

Sets environment variables inside the container. The withEnvironmentVariable method allows you to configure environment variables within the container.

Disabling auto-remove

Prevents the container from being automatically removed when stopped. By default, Docker removes containers after they stop. The withoutAutoRemove method disables this feature, keeping the container around even after it finishes its execution.

Copying files to a container

Copies files or directories from the host machine to the container. The copyToContainer method allows you to transfer files from the host system into the container’s file system.

Waiting for a condition

The withWaitBeforeRun method allows the container to pause its execution until a specified condition is met before starting.

Usage examples

MySQL and Generic Containers

Before configuring and starting the MySQL container, a PHP container is set up to execute the tests and manage the integration process.

This container runs within a Docker network and uses a volume for the database migrations. The following commands are used to prepare the environment:

  1. Create the Docker network:

  2. Create the volume for migrations:

  3. Run the PHP container:

The MySQL container is configured and started:

With the MySQL container started, it is possible to retrieve data, such as the address and JDBC connection URL:

The Flyway container is configured and only starts and executes migrations after the MySQL container is ready:

License

Docker container is licensed under MIT.

Contributing

Please follow the contributing guidelines to contribute to the project.


All versions of docker-container with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
symfony/process Version ^7.1
tiny-blocks/ksuid Version ^1
tiny-blocks/mapper Version ^1
tiny-blocks/collection Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tiny-blocks/docker-container contains the following files

Loading the files please wait ....