PHPackages                             decodelabs/slingshot - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. decodelabs/slingshot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

decodelabs/slingshot
====================

Unified dependency injection invoker

v0.3.5(8mo ago)018.2k14MITPHPPHP ^8.4CI passing

Since Nov 10Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/decodelabs/slingshot)[ Packagist](https://packagist.org/packages/decodelabs/slingshot)[ RSS](/packages/decodelabs-slingshot/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (26)Used By (14)

Slingshot
=========

[](#slingshot)

[![PHP from Packagist](https://camo.githubusercontent.com/cea92a3545cac3013e49c6ded3b1ce8b4e4db94ff8d97a8de5f16ac9473b3088/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f736c696e6773686f743f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/slingshot)[![Latest Version](https://camo.githubusercontent.com/b4760775d41aa9a9297b998ea5b8b4325b807efbcf333f5e7999528b3f5c3e13/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f736c696e6773686f742e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/slingshot)[![Total Downloads](https://camo.githubusercontent.com/e77e2a0e16a0fdee703122aafa94724c0c4a8e9c801e234c96a7bc4063ead9fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f736c696e6773686f742e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/slingshot)[![GitHub Workflow Status](https://camo.githubusercontent.com/426da868f9509ae288848054d612ad29fce3f69d93d0e380f9f8335707164669/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f736c696e6773686f742f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/slingshot/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/af40053561df56c1e18205c437604927bc114bec7ef5d184ecdf3776513c334a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f736c696e6773686f743f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/slingshot)

### Unified dependency injection invoker

[](#unified-dependency-injection-invoker)

Slingshot provides a simple interface for invoking methods on objects with dependency injection.

---

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

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/slingshot
```

Usage
-----

[](#usage)

Use a Slingshot instance to invoke a function with dependency injection:

```
use DecodeLabs\Slingshot;

$slingshot = new Slingshot(
    container: $container, // Psr\Container\ContainerInterface
    parameters: [
        'param1' => 'hello'
    ]
);

function test(
    string $param1,
    string $param2
) {
    return $param1 . ' '. $param2;
}

$output = $slingshot->invoke(test(...), [
    'param2' => 'world'
]); // hello world
```

Or instantiate an object with dependency injection:

```
use DecodeLabs\Harvest;

class Test {
    public function __construct(
        // Fetch the Harvest service (example) from container
        Harvest $param1,
        string $param2
    ) {
        // ...
    }
}

$testObect = $slingshot->instantiate(Test::class, [
    'param2' => 'value'
]);
```

Objects can be added to Slingshot by type for reference matching:

```
$object = new Test(...);
$slingshot->addType($object);

$slingshot->invoke(function(Test $test) {
    // ...
});
```

Licensing
---------

[](#licensing)

Slingshot is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance67

Regular maintenance activity

Popularity22

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

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 ~29 days

Recently: every ~6 days

Total

24

Last Release

242d ago

PHP version history (2 changes)v0.1.0PHP ^8.1

v0.1.12PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

[![betterthanclay](https://avatars.githubusercontent.com/u/1273586?v=4)](https://github.com/betterthanclay "betterthanclay (111 commits)")

---

Tags

dependency-injectioninstantiationphp

### Embed Badge

![Health badge](/badges/decodelabs-slingshot/health.svg)

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

###  Alternatives

[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/object-mapper

Provides a way to map an object to another object

34885.7k18](/packages/symfony-object-mapper)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[ajgarlag/feature-flag-bundle

Provides a feature flag mechanism

1417.8k](/packages/ajgarlag-feature-flag-bundle)

PHPackages © 2026

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