Download the PHP package yogarine/wait-for-it.php without Composer
On this page you can find all versions of the php package yogarine/wait-for-it.php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yogarine/wait-for-it.php
More information about yogarine/wait-for-it.php
Files in yogarine/wait-for-it.php
Package wait-for-it.php
Short Description A PHP implementation of Giles Hall's wait-for-it.sh script.
License MIT
Informations about the package wait-for-it.php
wait-for-it.php
wait-for-it.php is a PHP implementation of the wait-for-it.sh script by Gilles Hall.
It can be both run as a standalone executable or included in PHP and used by calling the wait_for_it() function. As standalone script it can be used as a drop-in replacement for wait-for-it.sh.
Usage
From the command line
From PHP:
Installation
As Composer package
You can install it globally to use it as a stand-alone command:
You can also install wait-for-it.php as a dependency of your project:
This will allow you to use the wait_for_it() function.
Docker
wait-for-it.php is also available as a Docker image:
You can also easily copy the script in your own Dockerfiles:
Just keep in mind you'll need to have the pcntl extension installed.
Usage in PHP code
When installed as composer package wait-for-it.php is automatically included
as helper file, and declares the wait_for_it() function.
It will wait and return true if the host came up, and false otherwise.
Examples
For example, let's test to see if we can access port 80 on www.google.com,
and if it is available, echo the message google is up.
You can set your own timeout with the -t or --timeout= option. Setting
the timeout value to 0 will disable the timeout:
The subcommand will be executed regardless if the service is up or not. If you
wish to execute the subcommand only if the service is up, add the --strict
argument. In this example, we will test port 81 on www.google.com which will
fail:
If you don't want to execute a subcommand, leave off the -- argument. This
way, you can test the exit condition of wait-for-it.php in your own scripts,
and determine how to proceed:
All versions of wait-for-it.php with dependencies
ext-pcntl Version *