PHPackages                             divsmith/airlock - 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. divsmith/airlock

ActiveLibrary

divsmith/airlock
================

IoC for non interface conforming dependencies.

1.0.1(11y ago)031PHP

Since Jul 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/divsmith/airlock)[ Packagist](https://packagist.org/packages/divsmith/airlock)[ RSS](/packages/divsmith-airlock/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Airlock
=======

[](#airlock)

Airlock is a simple abstract adapter class to provide decoupling to dependencies that don't specify their own interfaces.

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

[](#installation)

Install Airlock by adding the following to your composer.json file

```
{
    "require": {
        "divsmith/airlock": "1.*"
    }
}
```

Usage
-----

[](#usage)

1. Create an interface specifying the methods of the concrete dependency you are going to depend on.

    ```
    interface ExampleInterface {
        public function method1($args);
        public function method2($args);
        etc...
    }
    ```
2. Create an adapter class that extends Airlock and implements the interface.

    ```
    class ExampleInterfaceAdapter extends \Airlock\Airlock implements ExampleInterface {

        public function method1($args)
        {
            return $this->delegate(__FUNCTION__, func_get_args());
        }

        public function method2($args)
        {
            return $this->delegate(__FUNCTION__, func_get_args());
        }

    }
    ```

    Each method needs to contain

    ```
    return $this->delegate(__FUNCTION__, func_get_args());
    ```

    or it will not behave as expected.
3. Inject the concrete dependency via the adapter constructor. This can either be done by using the predefined Airlock constructor

    ```
    $adapter = new ExampleInterfaceAdapter(new ConcreteDependency());
    ```

    or typehinted and injected via an IoC container

    ```
    class ExampleInterfaceAdapter extends\Airlock\Airlock implements ExampleInterface {

        public function __construct(\Namespace\ConcreteDependency $dependency)
        {
            $this->locker = $dependency;
        }

        ...
    }
    ```
4. Enjoy! You can now typehint the interface and inject the adapter instead of the concrete dependency (assuming appropriate IoC bindings). Use the adapter exactly as you would the concrete dependency and sleep better at night knowing that your code is decoupled from it.

Other Usage
-----------

[](#other-usage)

You can use Airlock with empty interfaces that simply provide latches for your IoC container to resolve. Just inject your concrete dependency into your adapter and let Airlock do the rest. Not as architecturally sound as a well defined interface, but it gets you the benefits of not being tied to the concrete dependency while not requiring you to define each method in the adapter.

```
interface ExampleInterface {};

class ExampleAdapter extends \Airlock\Airlock implements ExampleInterface{

    public function __construct(\Namespace\ConcreteDependency $dependency)
    {
        $this->locker = $dependency;
    }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~15 days

Total

2

Last Release

4308d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ddc17355898bf2f75f8a8e3b8b0fb2bc47b2f4baa5668bb17ff46e9e01bdcfeb?d=identicon)[divsmith](/maintainers/divsmith)

---

Top Contributors

[![divsmith](https://avatars.githubusercontent.com/u/3256015?v=4)](https://github.com/divsmith "divsmith (47 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/divsmith-airlock/health.svg)

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

PHPackages © 2026

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