PHPackages                             fanmade/laravel-service-binding - 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. fanmade/laravel-service-binding

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

fanmade/laravel-service-binding
===============================

Provide configuration to allow service and repository binding and switching between them via environment variables

0.5.0(5y ago)013[1 issues](https://github.com/Fanmade/laravel-service-binding/issues)MITPHPPHP &gt;=7.2CI failing

Since Oct 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Fanmade/laravel-service-binding)[ Packagist](https://packagist.org/packages/fanmade/laravel-service-binding)[ Docs](https://github.com/Fanmade/laravel-service-binding)[ RSS](/packages/fanmade-laravel-service-binding/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

[![GitHub license](https://camo.githubusercontent.com/2db973c27c20568deef20ac959f1b27328553483ff0799a3196e8ea6ec025dd3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f46616e6d6164652f6c61726176656c2d736572766963652d62696e64696e67)](https://github.com/Fanmade/laravel-service-binding/blob/main/LICENSE)[![Code Coverage](https://camo.githubusercontent.com/11373f80fc42654aaa6958f6a1bb685fea7b7fb95b20ad9c921d07475422e947/68747470733a2f2f636f6465636f762e696f2f67682f66616e6d6164652f6c61726176656c2d736572766963652d62696e64696e672f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/fanmade/laravel-service-binding)[![GitHub issues](https://camo.githubusercontent.com/a96408972e81701c42cefa63442c6b65e7af92a875511f3149dc193a3e4d6dec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f46616e6d6164652f6c61726176656c2d736572766963652d62696e64696e67)](https://github.com/Fanmade/laravel-service-binding/issues)

EARLY WORK IN PROGRESS, WOULD NOT RECOMMEND USING IT YET
========================================================

[](#early-work-in-progress-would-not-recommend-using-it-yet)

Laravel Service Binding
=======================

[](#laravel-service-binding)

Laravel does provide all necessary tools to allow using service or repository binding. Just bind it in the service provider and you're good to go.

```
public function register()
   {
       $this->app->bind(FooRepositoryInterface::class, EloquentFooRepository::class);
       $this->app->bind(FooSearchServiceInterface::class, EloquentFooSearchService::class);
   }

```

Now if you created an `ElasticSearchFooSearchService` and you did everything properly, you only have to change the binding and everything should work fine. But there are several reasons why you might use different services on different systems and that can get messy quickly. You also can't switch between different repositories without altering code :( Maybe you start using `if`/`else` in the service provider now.

```
public function register()
   {
       $this->app->bind(FooRepositoryInterface::class, EloquentFooRepository::class);
       if (env('ELASTICSEARCH_FOO_SERVICE', 'default')) {
          $this->app->bind(FooSearchServiceInterface::class, ElasticSearchFooSearchService::class);
       } else {
          $this->app->bind(FooSearchServiceInterface::class, EloquentFooSearchService::class);
       }
   }

```

Or you switch to Symfony where that's not a problem because you only have to update your configuration files.

This package here does try to provide a solution for Laravel applications.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

2097d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/03ee7b67b9a5fc7e28528dcd9756394b83f8923c6592fde5aaa43189d0022f7b?d=identicon)[Fanmade](/maintainers/Fanmade)

---

Top Contributors

[![ACTINEO-Ben](https://avatars.githubusercontent.com/u/77456352?v=4)](https://github.com/ACTINEO-Ben "ACTINEO-Ben (20 commits)")[![Fanmade](https://avatars.githubusercontent.com/u/2896491?v=4)](https://github.com/Fanmade "Fanmade (3 commits)")

---

Tags

configurationfanmadelaravelrepositoriesrepositoryservicelaravelconfigurationservicerepositoryrepositoriesfanmade

### Embed Badge

![Health badge](/badges/fanmade-laravel-service-binding/health.svg)

```
[![Health](https://phpackages.com/badges/fanmade-laravel-service-binding/health.svg)](https://phpackages.com/packages/fanmade-laravel-service-binding)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90142.9k](/packages/emargareten-inertia-modal)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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