PHPackages                             facile-it/terminable-loop-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. facile-it/terminable-loop-command

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

facile-it/terminable-loop-command
=================================

A Shell+PHP wrapper to run Symfony console commands in loop under a daemon or Kubernetes

1.3.1(8mo ago)27140.0k↓21.9%5[2 PRs](https://github.com/facile-it/terminable-loop-command/pulls)MITPHPPHP ^8.2CI passing

Since Apr 5Pushed 1w ago2 watchersCompare

[ Source](https://github.com/facile-it/terminable-loop-command)[ Packagist](https://packagist.org/packages/facile-it/terminable-loop-command)[ RSS](/packages/facile-it-terminable-loop-command/feed)WikiDiscussions 1.x Synced 3d ago

READMEChangelog (10)Dependencies (15)Versions (19)Used By (0)

facile-it/terminable-loop-command
=================================

[](#facile-itterminable-loop-command)

[![Latest Stable Version](https://camo.githubusercontent.com/ad70ba480ce19785d946eacba96158ae2137dd1f52413cf08929b63e8dcb3434/68747470733a2f2f706f7365722e707567782e6f72672f666163696c652d69742f7465726d696e61626c652d6c6f6f702d636f6d6d616e642f76657273696f6e)](https://packagist.org/packages/facile-it/terminable-loop-command)[![Latest Unstable Version](https://camo.githubusercontent.com/c98f10ca3d75bd5916855be301511bec55cdea977a4282329885fbe2902979a9/68747470733a2f2f706f7365722e707567782e6f72672f666163696c652d69742f7465726d696e61626c652d6c6f6f702d636f6d6d616e642f762f756e737461626c65)](//packagist.org/packages/facile-it/terminable-loop-command)[![Build status](https://github.com/facile-it/terminable-loop-command/workflows/CI/badge.svg)](https://github.com/facile-it/terminable-loop-command/actions?query=workflow%3ACI)[![Coverage status](https://camo.githubusercontent.com/eea92c5cc8778b06b91c186479360b38b6978f9ae416ddbe632038969001c74a/68747470733a2f2f636f6465636f762e696f2f67682f666163696c652d69742f7465726d696e61626c652d6c6f6f702d636f6d6d616e642f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/facile-it/terminable-loop-command)

A Shell+PHP combination to run Symfony console commands in loop under a daemon or Kubernetes, instead of using a long running process.

This package contains a **shell script** and an **abstract Symfony Console Command class**; you need to write your command extending that class, and launch it through the shell script. Ideally, the script has to be used as a container entry point, and/or launched with a supervisor, like Docker Compose, Kubernetes, `supervisord`.

Installation
------------

[](#installation)

```
composer require facile-it/terminable-loop-command
```

Usage
-----

[](#usage)

Launch the shell script appending the desired PHP script to be executed in a loop:

```
vendor/bin/terminable-loop-command.sh my_custom_command.php
```

... where `my_custom_command.php` launches your command class, which must extend `AbstractTerminableCommand` (see the [test stub in this repo](https://github.com/facile-it/terminable-loop-command/blob/master/tests/Stub/StubTerminableCommand.php))

### Example with a command in a common Symfony app

[](#example-with-a-command-in-a-common-symfony-app)

When using it inside a Symfony application, do not forget to call `bin/console` as first argument:

```
vendor/bin/terminable-loop-command.sh bin/console my:command --optionA
```

... where the command is something like this:

```
