jascha030/service-provider

Service Provider interface for usage with PSR-11 ContainerInterface, based on container-interop/service-provider.

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/jascha030/service-provider

1.1.0 2025-09-22 22:03 UTC

This package is not auto-updated.

Last update: 2025-10-14 09:46:24 UTC


README

Copy of container-interop/service-providers, which seems unmaintained, but states that is still a work in progress. Because of this, I made a copy with some slight edits, to use in personal projects.

Installation

composer require jascha030/service-provider

The interface

The interface is pretty self explainitory, read the README.md of container-interop/service-providers for more info.

<?php

declare(strict_types=1);

namespace Jascha030\DI\ServiceProvider;

use Closure;
use Psr\Container\ContainerInterface;

/**
 * A service provider provides entries to a container.
 *
 * @see ContainerInterface
 */
interface ServiceProviderInterface
{
    /**
     * @return iterable<class-string|int|string,callable|Closure>
     */
    public function getFactories(): iterable;

    /**
     * @return iterable<class-string|int|string,callable|Closure>
     */
    public function getExtensions(): iterable;
}