PHPackages                             drabek-digital/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. drabek-digital/loopbind

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

drabek-digital/loopbind
=======================

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

v1.3.2(5mo ago)00[1 issues](https://github.com/DrabekDigital/loopbind/issues)MITPHPPHP &gt;=8.1

Since Feb 16Pushed 5mo agoCompare

[ Source](https://github.com/DrabekDigital/loopbind)[ Packagist](https://packagist.org/packages/drabek-digital/loopbind)[ Docs](https://github.com/DrabekDigital/loopbind)[ RSS](/packages/drabek-digital-loopbind/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (11)Versions (2)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 drabek-digital/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

32

—

LowBetter than 69% of packages

Maintenance72

Regular maintenance activity

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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

Unknown

Total

1

Last Release

158d ago

### Community

Maintainers

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

---

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 (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/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.

92641.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.7M334](/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.2M442](/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)
