PHPackages                             kiwicom/loopbind - 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. [CLI &amp; Console](/categories/cli)
4. /
5. kiwicom/loopbind

ActiveLibrary[CLI &amp; Console](/categories/cli)

kiwicom/loopbind
================

🛠️️ CLI tool to easily bind localhost network interface with additional IP and ensure matching record in /etc/hosts.

v1.3.1(1y ago)1212[1 PRs](https://github.com/kiwicom/loopbind/pulls)MITPHPPHP &gt;=8.1

Since Dec 19Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/kiwicom/loopbind)[ Packagist](https://packagist.org/packages/kiwicom/loopbind)[ Docs](https://github.com/kiwicom/loopbind)[ RSS](/packages/kiwicom-loopbind/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (11)Versions (11)Used By (0)

Loopbind
========

[](#loopbind)

🛠️️ CLI tool to easily bind localhost network interface with additional IP and ensure matching record in /etc/hosts.

Warning

**This tool should only be used in local environments and should not be used in production.**

**It is crucial to use this tool only on projects (configs) under your control as it can seriously compromise your /etc/hosts file.**

This is a helper tool to be installed via `composer global` to machines where the localhost deployment process of Docker composition (via `docker-compose.yaml`) is prepared in a way that it binds the ports on IP from localhost subnet block and multiple of such compositions should be allowed to run in parallel (differentiated by the IP).

Practically speaking this tool ensures that the localhost network interface (`lo0` on OS X) will also have another IP from localhost subnet block (for example `127.0.0.2`) and there will entry in `/etc/hosts` for particular domain routing to that IP (for example `127.0.0.2 example.test`).

Supported platforms:

PlatformSupportOS X✅Linux✅Windows❌Required underlying utilities:

- `sudo`
- `ifconfig`
- `sed`

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

[](#installation)

Run

```
composer global require kiwicom/loopbind
```

Then if you have composer bin directory on the `PATH` you can use it by calling `loopbind` in the CLI. So you can initialize the configuration with a CLI wizard:

```
$ loopbind init
> ENV variable name to extract IP address from (leave empty if you want to provide manually or want random one):
>
> Do you want to generate random free local IP:
>
>  [0] yes
>  [1] no
> > no
> IPv4 address from local block:
> 127.0.0.1
> Hostname (leave empty to continue):
> hostname
> Hostname (leave empty to continue):
>
> New config file `.loopbind.json` was created.
> Do you want to create .env file with variable IP:
>
>  [0] yes
>  [1] no
> > yes
> File `.env` was created with variable `IP` set to `127.0.0.2`.
> You appear to have .docker-compose.yml file in your directory. Run `docker compose stop`, replace port binding from `"80:80"` to `"$IP:80:80"` and then `docker copmose up`.
```

Usage
-----

[](#usage)

In the project root define a file named `.loopbind.json` with following content:

```
{
    "localIPAlias": "127.11.23.1",
    "hostname": "foobar.test"
}
```

Or when you need to bind multiple hostnames:

```
{
    "localIPAlias": "127.11.23.1",
    "hostname": ["www.foobar.test","foobar.test"]
}
```

Then in this directory you can run `loopbind apply` to run commands to ensure the binding. Also, you can run `loopbind unapply` to remove it and `loopbind show` to show the configuration and its status.

The commands are idempotent so repeated apply/unapply does nothing (and the apply command does not even need to run the command again).

Please note, that the config is expected to be in the current working directory.

Development
-----------

[](#development)

This projects uses following coding standard:

- PHPCS
- PHPStan analysis (`composer stan`)
- PHPUnit tests. (`composer unit`)

However, due to the expected side effects (changing the computer configuration after run) and application of KISS only a subset of functionality is tested automatically. Hence, testing of:

- `ApplyCommand`
- `UnapplyCommand`

should be done manually.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance65

Regular maintenance activity

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 63.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~201 days

Total

5

Last Release

440d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

v1.3.1PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/475549?v=4)[Jan Drábek](/maintainers/repli2dev)[@repli2dev](https://github.com/repli2dev)

![](https://www.gravatar.com/avatar/6b5a8e91c5f9ff4acb739339feed9869dd2cb5efa857538cb63bd797ccae1555?d=identicon)[janco](/maintainers/janco)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (12 commits)")[![repli2dev](https://avatars.githubusercontent.com/u/475549?v=4)](https://github.com/repli2dev "repli2dev (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kiwicom-loopbind/health.svg)

```
[![Health](https://phpackages.com/badges/kiwicom-loopbind/health.svg)](https://phpackages.com/packages/kiwicom-loopbind)
```

###  Alternatives

[kdyby/console

Symfony Console integration for Kdyby components

601.8M73](/packages/kdyby-console)[dogma/dogma

The incomplete standard library

25260.6k8](/packages/dogma-dogma)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
