middlewares / utils

Common utils used by PSR-15 middlewares
MIT License
51 stars 12 forks source link

Use the provided libraries factories #11

Closed oscarotero closed 4 years ago

oscarotero commented 5 years ago

Diactoros, Guzzle and Slim are implementing PSR-17, so remove them in this package.

oscarotero commented 5 years ago

Waiting for Guzzle v2: https://github.com/guzzle/psr7/milestone/2

oscarotero commented 5 years ago

And for Slim: https://github.com/slimphp/Slim-Psr7

fenric commented 5 years ago

And for Slim: https://github.com/slimphp/Slim-Psr7 Not used in versions 3.x and 4.x...

https://github.com/http-interop/http-factory-slim Conflicted with the latest Slim version...

fenric commented 5 years ago

Can I help? Is this the final variant?

private static function getInstance(): FactoryDiscovery
{
    if (!self::$instance) {
        self::$instance = new FactoryDiscovery([
            self::DIACTOROS,
            self::GUZZLE,
            self::SLIM,
            self::NYHOLM,
            self::SUNRISE,
        ]);
    }

    return self::$instance;
}

Really waiting for the release :)

oscarotero commented 5 years ago

When guzzle and slim release their stable versions with psr-17, I'll release the new version.

fenric commented 5 years ago

When guzzle and slim release their stable versions with psr-17, I'll release the new version.

Understood, many thanks for the answer. I use:

Middlewares\Utils\Factory::setResponseFactory(new ResponseFactory);
Middlewares\Utils\Factory::setServerRequestFactory(new ServerRequestFactory);
Middlewares\Utils\Factory::setStreamFactory(new StreamFactory);
Middlewares\Utils\Factory::setUriFactory(new UriFactory);

All is well :)

oscarotero commented 5 years ago

To use this version temporary, you can require the dev-feature/psr-17 version in composer.json