Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Utils Laravel Package

middlewares/utils

Common utilities for Middlewares PSR packages: auto-discovered PSR-7/PSR-17 Factory (Diactoros, Guzzle, Slim, Nyholm, Sunrise) plus PSR-15 Dispatcher for testing, callable handler helpers, and HTTP error exceptions.

View on GitHub
Deep Wiki
Context7
4.0.2

Fixed

  • PHP 8.4 deprecation errors (implicitly nullable parameter) [#30]
4.0.1

Fixed

  • Support for Php 8.4 [#29].
4.0.0

Added

  • Support for psr/http-message 2.x (if you don't use slim/psr7 or sunrise/http-message as factory)

Changed

  • Updated dependencies and tests

Removed

  • Support for PHP prior to 8.1.
3.3.0

Added

  • Support for psr/container v2.x [#26]
3.2.0

Fixed

  • Added support for PHP 8 [#22] [#23]
3.1.0

Changed

  • Zend Diactoros is deprecated, switched to Laminas Diactoros [#20], [#21]. THIS IS A BREAKING CHANGE, so, if you want to keep using Zend Diactoros, you should configure the Factory as follows:
    Factory::setFactory(
      new FactoryDiscovery([
          'request' => 'Zend\Diactoros\RequestFactory',
          'response' => 'Zend\Diactoros\ResponseFactory',
          'serverRequest' => 'Zend\Diactoros\ServerRequestFactory',
          'stream' => 'Zend\Diactoros\StreamFactory',
          'uploadedFile' => 'Zend\Diactoros\UploadedFileFactory',
          'uri' => 'Zend\Diactoros\UriFactory',
      ])
    );
    
3.0.1

Fixed

  • Moved a dependency to dev
  • Updated docs
3.0.0

Added

  • Added FactoryInterface that returns all PSR-17 factories
  • Added FactoryDiscovery class to discover automatically PSR-17 implementation libraries
  • Added Factory::getFactory() and Factory::setFactory() to set manually PSR-17 factories
  • Added Factory::getResponseFactory()
  • Added Factory::getRequestFactory()
  • Added Factory::getServerRequestFactory()
  • Added Factory::getStreamFactory()
  • Added Factory::getUriFactory()
  • Added Factory::getUploadedFileFactory()
  • Added Sunrise to the list of factories detected automatically

Removed

  • Support for PHP 7.0 and 7.1
  • Factory::setStrategy
  • HttpErrorException::setContext method, to make the exception class inmutable
  • Traits HasResponseFactory and HasStreamFactory
2.2.0

Added

  • Middlewares\Utils\Dispatcher implements RequestHandlerInterface [#16], [#17]
2.1.1

Added

  • Added Nyholm\Psr7 to the list of factories detected automatically
2.1.0

Added

  • New trait HasResponseFactory used by many middlewares that need to configure the PSR-17 response factory.
  • New trait HasStreamFactory used by many middlewares that need to configure the PSR-17 stream factory.
2.0.0

Added

  • New methods added to Factory to return PSR-17 factories: getResponseFactory, getServerRequestFactory, getStreamFactory and getUriFactory.
  • New method Factory::setStrategies() to configure the priority order of the Diactoros, Guzzle and Slim factories or register new classes.
  • Added a second argument to Callablehandler constructor to pass a response factory

Changed

  • Exchanged abandoned http-interop/http-factory with psr/http-factory
  • Changed the signature of Factory::createServerRequest() to be aligned with PSR-17
  • Changed the signature of Factory::createStream() to be aligned with PSR-17
  • Changed the signature of Factory::createResponse() to be aligned with PSR-17
1.2.0

Changed

  • Updated http-interop/http-factory to 0.4
1.1.0

Added

  • Imported HttpErrorException from error handler middleware
1.0.0

Changed

  • Replaced http-interop/http-server-middleware with psr/http-server-middleware.

Removed

  • Removed Middlewares\Utils\Helpers because contains just one helper and it's no longer needed.
0.14.0

Added

  • New class RequestHandlerContainer implementing PSR-11 to resolve handlers in any format (classes, callables) and return PSR-15 RequestHandlerInterface instances. This can be used to resolve router handlers, for example.

Changed

  • The signature of CallableHandler was simplified. Removed $resolver and $arguments in the constructor.

Removed

  • Deleted all callable resolvers classes. Use the RequestHandlerContainer, or any other PSR-11 implementation.
0.13.0

Changed

  • The minimum PHP version supported is 7.0
  • Replaced http-interop/http-middleware with http-interop/http-server-middleware.
  • Changed Middlewares\Utils\CallableHandler signature. Now it is instantiable and can be used as middleware and server request handler.

Removed

  • Middlewares\Utils\CallableMiddleware. Use Middlewares\Utils\CallableHandler instead.
0.12.0

Changed

  • Append .dist suffix to phpcs.xml and phpunit.xml files
  • Changed the configuration of phpcs and php_cs
  • Upgraded phpunit to the latest version and improved its config file
  • Updated http-interop/http-middleware to 0.5
0.11.1

Changed

  • Middlewares\Utils\CallableHandler expects one of the following values returned by the callable:
    • A Psr\Http\Message\ResponseInterface
    • null or scalar
    • an object with __toString method implemented Otherwise, throws an UnexpectedValueException
  • Middlewares\Helpers::fixContentLength only modifies or removes the Content-Length header, but does not add it if didn't exist previously.
0.11.0

Added

  • New class Middlewares\Utils\Helpers with common helpers to manipulate PSR-7 messages
  • New helper Middlewares\Utils\Helpers::fixContentLength used to add/modify/remove the Content-Length header of a http message.

Changed

  • Updated http-interop/http-factory to 0.3
0.10.1

Fixed

  • Fixed changelog file
0.10.0

Changed

  • Replaced deprecated container-interop by psr/contaienr (PSR-11).
  • Middlewares\Utils\Dispatcher throws exceptions if the middlewares does not implement Interop\Http\ServerMiddleware\MiddlewareInterface or does not return an instance of Psr\Http\Message\ResponseInterface.
  • Moved the default factories to Middlewares\Utils\Factory namespace.
  • Minor code improvements.
0.9.0

Added

  • Callable resolves to create callables from various representations

Removed

  • Middlewares\Utils\CallableHandler::resolve
0.8.0

Changed

  • Updated http-interop/http-middleware to 0.4
  • Updated friendsofphp/php-cs-fixer to 2.0
0.7.0

Added

  • New static helper Middlewares\Utils\Dispatcher::run to create and dispatch a request easily
0.6.1

Fixed

  • Ensure that the body of the serverRequest is writable and seekable.
0.6.0

Added

  • ServerRequest factory
  • Middlewares\Utils\Dispatcher accepts Closure as middleware components

Changed

  • Middlewares\Utils\Dispatcher creates automatically a response if the stack is exhausted
0.5.0

Added

  • Middlewares\Utils\CallableMiddleware class, to create middlewares from callables
  • Middlewares\Utils\Dispatcher class, to execute the middleware stack and return a response.
0.4.0

Changed

  • Updated http-interop/http-factory to 0.2
0.3.1

Fixed

  • Bug in CallableHandler that resolve to the declaring class of a method instead the final class.
0.3.0

Added

  • Middlewares\Utils\CallableHandler class, allowing to resolve and execute callables safely.
0.2.0

Added

  • Uri factory
0.1.0

Added

  • Response factory
  • Stream factory
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky