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 issues](https://github.com/kiwicom/loopbind/issues)[1 PRs](https://github.com/kiwicom/loopbind/pulls)MITPHPPHP &gt;=8.1

Since Dec 19Pushed 4mo 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 yesterday

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

33

—

LowBetter than 72% of packages

Maintenance39

Infrequent updates — may be unmaintained

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

486d 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

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[nette/di

💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP features.

93041.5M1.6k](/packages/nette-di)[nette/security

🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)

3889.7M331](/packages/nette-security)[nette/component-model

⚛ Nette Component Model

28817.0M106](/packages/nette-component-model)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M435](/packages/ssch-typo3-rector)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)

PHPackages © 2026

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