jascha030/service-provider

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

1.0.0 2023-02-05 22:05 UTC

This package is not auto-updated.

Last update: 2024-04-30 02:34:50 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;
}