PHPackages                             andrewalf/service\_providers - 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. [Framework](/categories/framework)
4. /
5. andrewalf/service\_providers

ActiveLibrary[Framework](/categories/framework)

andrewalf/service\_providers
============================

Laravel-like service providers for slim framework

0261PHP

Since May 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/andrewalf/service-providers)[ Packagist](https://packagist.org/packages/andrewalf/service_providers)[ RSS](/packages/andrewalf-service-providers/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-like service providers.
===============================

[](#laravel-like-service-providers)

This package is made for Slim, to make it's configuration a little bit better, but you can use it in any project. This package is framework agnostic, it relies only on PSR-11 Container interface.

Installing
----------

[](#installing)

```
composer require andrewalf/service_providers

```

Running the tests
-----------------

[](#running-the-tests)

```
composer run tests

```

Usage
-----

[](#usage)

1. Create `service_providers.php` file in your project's root. This file should return array of service providers full class names.
2. In your `index.php` file require that file in a variable.
3. (*Pass this step if RouteServiceProvider is not used*) In your `index.php` file add in DI container your app instance with the "app" key.
4. Create `ServiceProviderRunner` instance, with psr-11 DI container and providers array as constructor params. Call it's **runProviders** method

Now you can add your custom service providers. They have two methods: **register** and **boot**. In **register** method, which called first, you should register dependencies in the container. In **boot** method feel free to modify and configure your app as you want. For example, you can create *EventListenersServiceProvider* where keep all your listeners attachments.

Usage example for Slim 3 framework.
-----------------------------------

[](#usage-example-for-slim-3-framework)

**index.php**

```
    $app = new \Slim\App($settings);
    $container = $app->getContainer();

    // we use RouteServiceProvider
    $container['app'] = function ($c) use ($app) {
        return $app;
    };

    $providersArray = require '../service_providers.php';
    (new \Andrewalf\ServiceProviderRunner($app->getContainer(), $providersArray))->runProviders();
```

**service\_providers.php**

```
    return [
        \Andrewalf\RouteServiceProvider::class,
        \Andrewalf\AppServiceProvider::class
    ];
```

RouteServiceProvider
--------------------

[](#routeserviceprovider)

This is made mostly for Slim. This provider loads app routes from separated files: web.php and api.php. Path to these files is hardcoded in provider. Feel free to copy and modify it.

**TODO**: composer command for coping package providers to your providers directory.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/60c0c73aa734336e38024f5305d8e7555610e718043822eba1b3cfe64c8415bf?d=identicon)[andrewalf](/maintainers/andrewalf)

---

Top Contributors

[![andrewalf](https://avatars.githubusercontent.com/u/14373322?v=4)](https://github.com/andrewalf "andrewalf (27 commits)")

### Embed Badge

![Health badge](/badges/andrewalf-service-providers/health.svg)

```
[![Health](https://phpackages.com/badges/andrewalf-service-providers/health.svg)](https://phpackages.com/packages/andrewalf-service-providers)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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