uuf6429/wait4services

Small tool that waits until services are online.

0.0.2 2018-02-07 23:00 UTC

This package is auto-updated.

Last update: 2024-10-12 21:40:18 UTC


README

build status coverage report Minimum PHP Version License: MIT Packagist

A simple tool for waiting until all required services are up and running.

screenshot

Installation

Add via composer, either locally or globally (depending on your needs):

composer require uuf6429/wait4services

(to install globally just add "global" before "require")

Usage

Let's say you want to run some tests on a system bootstrapped from Docker, this tool could be used like so:

# start docker services
docker-compose up -d

# wait for the services
vendor/bin/wait4services \
  "pdo-mysql://dbuser:dbpass@docker/somedb" \
  "http://docker/wp-admin"

# run your tests
vendor/bin/phpunit

Extending

It's a bit difficult to extend due to autoloading, however it can be achieved with the following steps:

  1. Create your handler extending uuf6429\WFS\Handler\Handler

  2. At the end of that file (or in some other file) use the following code:

    if (uuf6429\WFS\HandlerManager::class) {
        uuf6429\WFS\HandlerManager::getInstance()
            ->register(new YourCustomHandler());
    }
  3. In your composer.json make sure to put the previous file in autoload\files section:

    "autoload": {
        "files": ["path/to/your/handler.php"]
    }