A PSR-15 middleware to handle content negotiation

Overview

Content negotiation middleware

Total Downloads Latest Stable Version Unstable Version

Build Status Code Coverage

Motivation

Packages like middlewares/negotiation do a very good job to detect the correct content type based on the Accept header (or extension in the URI), however they delegate to the RequestHandler to format the content according to the detected mime type.

That works fine for most cases but it usually creates a lot of duplication in complex software, where every single RequestHandler should do that formatting (or depend on some component to do that). That logic should also be added to the middleware that handles exceptions and converts them to the appropriated HTTP response.

The goal of this middleware is to provide full content negotiation (detection and formatting).

Installation

This package is available on Packagist, and we recommend you to install it using Composer:

composer require lcobucci/content-negotiation-middleware middlewares/negotiation laminas/laminas-diactoros

Adventure mode

If you're ready for an adventure and don't want to use middlewares/negotiation to handle the detection or laminas/diactoros to create the response body (StreamInterface implementation), don't despair! You'll only have to use the normal ContentTypeMiddleware::__construct() instead of ContentTypeMiddleware::fromRecommendedSettings().

We do have a small preference for the mentioned packages and didn't want to reinvent the wheel... but you know, it's a free world.

PHP Configuration

In order to make sure that other components are returning the expected objects we decided to use assert(), which is a very interesting feature in PHP but not often used. The nice thing about assert() is that we can (and should) disable it in production mode so that we don't have useless statements.

So, for production mode, we recommend you to set zend.assertions to -1 in your php.ini. For development, you should leave zend.assertions as 1 and set assert.exception to 1, which will make PHP throw an AssertionError when things go wrong.

Check the documentation for more information: https://secure.php.net/manual/en/function.assert.php

Usage

Your very first step is to create the middleware using the correct configuration:

<?php
declare(strict_types=1);

use Lcobucci\ContentNegotiation\ContentTypeMiddleware;
use Lcobucci\ContentNegotiation\Formatter\Json;
use Lcobucci\ContentNegotiation\Formatter\StringCast;
use Laminas\Diactoros\StreamFactory;

$middleware = ContentTypeMiddleware::fromRecommendedSettings(
    // First argument is the list of formats you want to support:
    [
        'json',
        // You may also specify the full configuration of the format.
        // That's handy if you need to add extensions or mime-types:
        'html' => [
            'extension' => ['html', 'htm', 'php'],
            'mime-type' => ['text/html', 'application/xhtml+xml'],
            'charset' => true,
        ],
    ],
    // It's very important to mention that:
    //
    // * the first format will be used as fallback (no acceptable mime type
    // found)
    // * the order of elements does matter
    // * the first element of `mime-type` list will be used as negotiated type


    // The second argument is the list of formatters that will be used for
    // each mime type:
    [
        'application/json' => new Json(),
        'text/html'        => new StringCast(),
    ],

     // The last argument is any implementation for the StreamFactoryInterface (PSR-17)  
    new StreamFactory()
);

Then you must add the middleware to very beginning of your pipeline, which will depend on the library/framework you're using, but it will be something similar to this:

<?php

// ...

$application->pipe($middleware);

Finally, you just need to use UnformattedResponse as return of the request handlers you create to trigger to formatting when needed:

<?php
declare(strict_types=1);

namespace Me\MyApp;

use Fig\Http\Message\StatusCodeInterface;
use Lcobucci\ContentNegotiation\UnformattedResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Laminas\Diactoros\Response;

final class MyHandler implements RequestHandlerInterface
{
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        // Does the necessary process and creates `$result` with the unformatted
        // content.

        return new UnformattedResponse(
            (new Response())->withStatus(StatusCodeInterface::STATUS_CREATED),
            $result
        );
    }
}

Formatters

We provide some basic formatters by default:

  • Json
  • StringCast
  • JmsSerializer (requires you to also install and configure jms/serializer)
  • Plates (requires you to also install and configure league/plates)
  • Twig (requires you to also install and configure twig/twig)

If you want to create a customised formatter the only thing needed is to implement the Formatter interface:

<?php
declare(strict_types=1);

namespace Me\MyApp;

use Lcobucci\ContentNegotiation\Formatter;
use Lcobucci\ContentNegotiation\UnformattedResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamFactoryInterface;

final class MyFancyFormatter implements Formatter
{
    public function format(UnformattedResponse $response, StreamFactoryInterface $streamFactory): ResponseInterface
    {
        $content = ''; // Do some fancy formatting of $response->getUnformattedContent() and put into $content

        return $response->withBody($streamFactory->createStream($content));
    }
}

License

MIT, see LICENSE.

Comments
  • Change `Formatter` interface to allow returning complete PSR 7 response

    Change `Formatter` interface to allow returning complete PSR 7 response

    Continuing #49

    Not finished: not all tests fixed. Let me know if it is ok to you and I'll finish.

    Pay attention to ContentTypeMiddleware::NOT_ACCEPTABLE constant and getNotAcceptableFormatter(). It allows redefine formatter for not acceptable case in the formatters map.

    BC-break Improvement 
    opened by hiqsol 8
  • Allow raw formatter returning complete response

    Allow raw formatter returning complete response

    This allows to use formatting library returning complete response. E.g. woohoolabs/yin returns whole Psr7 response and it's not reasonable to convert it to string and back to be compatible with current Formatter interface.

    I can add tests if you're ok with the idea.

    opened by hiqsol 8
  • Update phpunit/phpunit requirement from ^9.2 to ^9.4

    Update phpunit/phpunit requirement from ^9.2 to ^9.4

    Updates the requirements on phpunit/phpunit to permit the latest version.

    Changelog

    Sourced from phpunit/phpunit's changelog.

    9.4.0 - 2020-10-02

    Added

    • #4462: Support for Cobertura XML report format
    • #4464: Filter based on covered (@covers) / used (@uses) units of code
    • #4467: Convenient custom comparison of objects

    Changed

    • The PHPUnit XML configuration generator (that is invoked using the --generate-configuration CLI option) now asks for a cache directory (default: .phpunit.cache)
    Commits
    • ef53346 Prepare release
    • 6099c5e Report an error instead of a failure when the prerequisites for using the cus...
    • 6f084fa Merge branch '9.3'
    • b1f4768 Merge branch '8.5' into 9.3
    • 684ef7b Also mention output
    • 904b6e7 Merge branch '9.3'
    • b03b938 Merge branch '8.5' into 9.3
    • 155e5b0 Motivated by #4471, do not even try to add non-public methods as test methods
    • c9f25ee Merge branch '9.3'
    • b77f2da Update ChangeLog
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 4
  • [PHP 7.4] Versioning of ext-json

    [PHP 7.4] Versioning of ext-json

    Up to PHP 7.3, the json extension used to follow its own versioning.

    Now, in PHP 7.4+, it is following the same as other extensions: PHP's version number:

    • json: https://3v4l.org/1NjFH
    • reflection: https://3v4l.org/ca9vS

    For reference: php/php-src#4459

    @lcobucci How can we solve this? Adding || ^7.4 or replacing it with * when declaring ext-json in the requirements of Composer?

    Improvement 
    opened by carusogabriel 4
  • Update phpunit/phpunit requirement from ^9.0 to ^9.1

    Update phpunit/phpunit requirement from ^9.0 to ^9.1

    Updates the requirements on phpunit/phpunit to permit the latest version.

    Changelog

    Sourced from phpunit/phpunit's changelog.

    9.1.1 - 2020-04-03

    Fixed

    • #4162: Raising an exception from a test double's configured method does not work

    9.1.0 - 2020-04-03

    Added

    • #4061: Implement assertIsNotReadable() as alternative for assertNotIsReadable() with a more readable name
    • #4064: Implement assertIsNotWritable() as alternative for assertNotIsWritable() with a more readable name
    • #4067: Implement assertDirectoryDoesNotExist() as alternative for assertDirectoryNotExists() with a more readable name
    • #4070: Implement assertDirectoryIsNotReadable() as alternative for assertDirectoryNotIsReadable() with a more readable name
    • #4073: Implement assertDirectoryIsNotWritable() as alternative for assertDirectoryNotIsWritable() with a more readable name
    • #4076: Implement assertFileDoesNotExist() as alternative for assertFileNotExists() with a more readable name
    • #4079: Implement assertFileIsNotReadable() as alternative for assertFileNotIsReadable() with a more readable name
    • #4082: Implement assertFileIsNotWritable() as alternative for assertFileNotIsWritable() with a more readable name
    • #4085: Implement assertMatchesRegularExpression() as alternative for assertRegExp() with a more readable name
    • #4088: Implement assertDoesNotMatchRegularExpression() as alternative for assertNotRegExp() with a more readable name
    • #4100: Implement failOnIncomplete and failOnSkipped configuration options as well as --fail-on-incomplete and --fail-on-skipped commandline options
    • #4130: Canonicalize JSON values in failure message
    • #4136: Allow loading PHPUnit extensions via command-line options
    • #4148: Support for @preCondition and @postCondition annotations

    Changed

    • #4039: Deprecate custom test suite loader
    • #4062: Deprecate assertNotIsReadable()
    • #4065: Deprecate assertNotIsWritable()
    • #4068: Deprecate assertDirectoryNotExists()
    • #4071: Deprecate assertDirectoryNotIsReadable()
    • #4074: Deprecate assertDirectoryNotIsWritable()
    • #4077: Deprecate assertFileNotExists()
    • #4080: Deprecate assertFileNotIsReadable()
    • #4083: Deprecate assertFileNotIsWritable()
    • #4086: Deprecate assertRegExp()
    • #4089: Deprecate assertNotRegExp()
    • #4091: Deprecate assertEqualXMLStructure()
    • #4095: Improve performance of StringContains constraint
    • #4105: Deprecate multiple test case classes in single file and test case class name differing from filename
    • #4141: Deprecate Prophecy integration
    Commits
    • 848f652 Prepare release
    • 0784cf5 Fix regression introduced in 4f0b297aec516b73c69817daf6691778ea8ec113
    • 74f0f57 Fix
    • 6cb28e5 Merge branch '8.5' into 9.1
    • 6f19efd Skip this test on PHP 8
    • cd24cdd Delete old ChangeLog
    • ef2af93 Prepare release
    • 2964a6e Disable test until phpspec/prophecy-phpunit:^2.0 has a stable release
    • 7a138d7 Use TestRunner::writeMessage() for test suite loader deprecation warnings
    • 10da552 Move printing of test suite loader related warnings from TestSuite to TestRunner
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    Dependabot will merge this PR once it's up-to-date and CI passes on it, as requested by @lcobucci.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 3
  • Bump symfony/polyfill-ctype from 1.23.0 to 1.24.0

    Bump symfony/polyfill-ctype from 1.23.0 to 1.24.0

    Bumps symfony/polyfill-ctype from 1.23.0 to 1.24.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Dependencies 
    opened by dependabot[bot] 2
  • Bump twig/twig from 3.3.4 to 3.3.7

    Bump twig/twig from 3.3.4 to 3.3.7

    Bumps twig/twig from 3.3.4 to 3.3.7.

    Changelog

    Sourced from twig/twig's changelog.

    3.3.7 (2022-01-03)

    • Allow more null support when Twig expects a string (for better 8.1 support)
    • Only use Commonmark extensions if markdown enabled

    3.3.6 (2022-01-03)

    • Only use Commonmark extensions if markdown enabled

    3.3.5 (2022-01-03)

    • Allow CommonMark extensions to easily be added
    • Allow null when Twig expects a string (for better 8.1 support)
    • Make some performance optimizations
    • Allow Symfony translation contract v3+
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Dependencies 
    opened by dependabot[bot] 2
  • Bump symfony/filesystem from 5.2.1 to 5.2.2

    Bump symfony/filesystem from 5.2.1 to 5.2.2

    ⚠️ Dependabot is rebasing this PR ⚠️

    If you make any changes to it yourself then they will take precedence over the rebase.


    Bumps symfony/filesystem from 5.2.1 to 5.2.2.

    Release notes

    Sourced from symfony/filesystem's releases.

    v5.2.2

    Changelog (https://github.com/symfony/filesystem/compare/v5.2.1...v5.2.2)

    • no changes
    Commits
    • 262d033 Merge branch '4.4' into 5.1
    • 83a6fee Use createMock() and use import instead of FQCN
    • 4ff1d2e Merge branch '4.4' into 5.1
    • a27af3b Use ::class keyword when possible
    • 03901f1 Merge branch '4.4' into 5.1
    • 5dfa00b Improve composer.json descriptions
    • bd2e4c6 Merge branch '4.4' into 5.1
    • da72813 Bump license year
    • 11960b8 Merge branch '4.4' into 5.1
    • 1dcbcd5 CS: Apply ternary_to_null_coalescing fixer
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 2
  • Bump symfony/console from 5.2.1 to 5.2.2

    Bump symfony/console from 5.2.1 to 5.2.2

    ⚠️ Dependabot is rebasing this PR ⚠️

    If you make any changes to it yourself then they will take precedence over the rebase.


    Bumps symfony/console from 5.2.1 to 5.2.2.

    Release notes

    Sourced from symfony/console's releases.

    v5.2.2

    Changelog (https://github.com/symfony/console/compare/v5.2.1...v5.2.2)

    • bug #39932 Fix Closure code binding when it is a static anonymous function (fancyweb)
    Commits
    • d62ec79 Merge branch '5.1' into 5.2
    • d9a267b Merge branch '4.4' into 5.1
    • 24026c4 Use createMock() and use import instead of FQCN
    • a5dbec2 Merge branch '5.1' into 5.2
    • d6ecfe3 Merge branch '4.4' into 5.1
    • a6d92f8 Update ConsoleEvents.php
    • c525b23 Merge branch '5.1' into 5.2
    • 7db4781 Merge branch '4.4' into 5.1
    • 492097a bug #39932 [Console] [Command] Fix Closure code binding when it is a static a...
    • 8a7755b Merge branch '4.4' into 5.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 2
  • Bump symfony/string from 5.2.1 to 5.2.2

    Bump symfony/string from 5.2.1 to 5.2.2

    ⚠️ Dependabot is rebasing this PR ⚠️

    If you make any changes to it yourself then they will take precedence over the rebase.


    Bumps symfony/string from 5.2.1 to 5.2.2.

    Release notes

    Sourced from symfony/string's releases.

    v5.2.2

    Changelog (https://github.com/symfony/string/compare/v5.2.1...v5.2.2)

    • bug #39795 Dont allow unserializing classes with a destructor - 5.1 (jderusse)
    Commits
    • c954688 Fix merge
    • 3300775 Changed private static array-properties to const static properties newly intr...
    • bfc83d1 Merge branch '5.1' into 5.2
    • 83bbb92 Changed private static array-properties to const static properties newly intr...
    • 083c71b Merge branch '5.1' into 5.2
    • 8a90f72 Merge branch '4.4' into 5.1
    • 2f833cf Merge branch '5.1' into 5.2
    • 0b171a3 bug #39795 Dont allow unserializing classes with a destructor - 5.1 (jderusse)
    • 7a62495 Merge branch '5.1' into 5.2
    • 760c239 Improve composer.json descriptions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 2
  • Bump symfony/process from 5.2.1 to 5.2.2

    Bump symfony/process from 5.2.1 to 5.2.2

    ⚠️ Dependabot is rebasing this PR ⚠️

    If you make any changes to it yourself then they will take precedence over the rebase.


    Bumps symfony/process from 5.2.1 to 5.2.2.

    Release notes

    Sourced from symfony/process's releases.

    v5.2.2

    Changelog (https://github.com/symfony/process/compare/v5.2.1...v5.2.2)

    • bug #39797 Dont allow unserializing classes with a destructor (jderusse)
    Commits
    • 313a38f Merge branch '5.1' into 5.2
    • d279ae7 Merge branch '4.4' into 5.1
    • 7e950b6 Use createMock() and use import instead of FQCN
    • b8d6eff Merge branch '5.1' into 5.2
    • 9ee12c5 Merge branch '4.4' into 5.1
    • e9c4ef4 CS fix
    • 68c1306 Merge branch '5.1' into 5.2
    • fdd3107 Merge branch '4.4' into 5.1
    • 89b55cb Dont allow unserializing classes with a destructor
    • 0ff3bf7 Merge branch '5.1' into 5.2
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    Dependencies 
    opened by dependabot-preview[bot] 2
  • Bump symfony/finder from 6.2.0 to 6.2.3

    Bump symfony/finder from 6.2.0 to 6.2.3

    Bumps symfony/finder from 6.2.0 to 6.2.3.

    Release notes

    Sourced from symfony/finder's releases.

    v6.2.3

    Changelog (https://github.com/symfony/finder/compare/v6.2.2...v6.2.3)

    • no significant changes
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Dependencies 
    opened by dependabot[bot] 0
  • Bump symfony/console from 6.2.2 to 6.2.3

    Bump symfony/console from 6.2.2 to 6.2.3

    Bumps symfony/console from 6.2.2 to 6.2.3.

    Release notes

    Sourced from symfony/console's releases.

    v6.2.3

    Changelog (https://github.com/symfony/console/compare/v6.2.2...v6.2.3)

    • bug #48784 Correctly overwrite progressbars with different line count per step (ncharalampidis)
    Commits
    • 0f57961 Merge branch '6.1' into 6.2
    • b800f23 Merge branch '6.0' into 6.1
    • 2ab3073 Merge branch '5.4' into 6.0
    • 58422fd [Console] Correctly overwrite progressbars with different line count per step
    • f3212cd Merge branch '6.1' into 6.2
    • 9413b2e Merge branch '6.0' into 6.1
    • 9050b8c Merge branch '5.4' into 6.0
    • 9bd719e [Console] Fix a test when pcntl is not available (following #48329)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Dependencies 
    opened by dependabot[bot] 0
  • Bump phpunit/php-code-coverage from 9.2.22 to 9.2.23

    Bump phpunit/php-code-coverage from 9.2.22 to 9.2.23

    Bumps phpunit/php-code-coverage from 9.2.22 to 9.2.23.

    Changelog

    Sourced from phpunit/php-code-coverage's changelog.

    [9.2.23] - 2022-12-28

    Fixed

    • #971: PHP report does not handle serialized code coverage data larger than 2 GB
    • #974: Executable line analysis fails for declarations with enumerations and unions
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    Dependencies 
    opened by dependabot[bot] 0
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Awaiting Schedule

    These updates are awaiting their schedule. Click on a checkbox to get an update now.

    • [ ] Lock file maintenance

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

    Detected dependencies

    composer
    composer.json
    • php ^8.1
    • fig/http-message-util ^1.1.5
    • psr/http-factory ^1.0.1
    • psr/http-message ^1.0.1
    • psr/http-server-middleware ^1.0.1
    • infection/infection ^0.26
    • jms/serializer ^3.18.2
    • laminas/laminas-diactoros ^2.24.0
    • lcobucci/coding-standard ^9.0
    • league/plates ^3.4
    • middlewares/negotiation ^2.1
    • phpstan/extension-installer ^1.2
    • phpstan/phpstan ^1.9.6
    • phpstan/phpstan-deprecation-rules ^1.1.1
    • phpstan/phpstan-phpunit ^1.3.3
    • phpstan/phpstan-strict-rules ^1.4.4
    • phpunit/phpunit ^9.5.27
    • twig/twig ^3.5.0
    docker-compose
    .github/workflows/composer-json-lint.yml
    github-actions
    .github/workflows/coding-standards.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2
    .github/workflows/composer-json-lint.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2
    .github/workflows/merge-bot.yml
    • ridedott/merge-me-action v2.10.40
    .github/workflows/mutation-tests.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2
    • codecov/codecov-action v3.1.1
    .github/workflows/phpunit.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2
    .github/workflows/release-on-milestone-closed.yml
    • actions/checkout v3
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    • laminas/automatic-releases v1
    .github/workflows/static-analysis.yml
    • actions/checkout v3
    • shivammathur/setup-php v2
    • actions/cache v3.2.2

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
  • Update dependency php to ^8.2.0

    Update dependency php to ^8.2.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | php | require | minor | ^8.1 -> ^8.2.0 |


    Release Notes

    php/php-src

    v8.2.0

    Compare Source

    v8.1.13

    Compare Source

    v8.1.12

    Compare Source

    v8.1.11

    Compare Source

    v8.1.10

    Compare Source

    v8.1.9

    Compare Source

    v8.1.8

    Compare Source

    v8.1.7

    Compare Source

    v8.1.6

    Compare Source

    v8.1.5

    Compare Source

    v8.1.4

    Compare Source

    v8.1.3

    Compare Source

    v8.1.2

    Compare Source

    v8.1.1

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    renovate 
    opened by renovate[bot] 0
Releases(3.1.0)
Owner
Luís Cobucci
A software engineer that also loves to share his thoughts about quality, tests and OOP. Member of the PHP community and contributor to open source projects.
Luís Cobucci
Content Negotiation tools for PHP.

Negotiation Negotiation is a standalone library without any dependencies that allows you to implement content negotiation in your application, whateve

William Durand 1.3k Dec 22, 2022
PSR-7 middleware foundation for building and dispatching middleware pipelines

laminas-stratigility From "Strata", Latin for "layer", and "agility". This package supersedes and replaces phly/conduit. Stratigility is a port of Sen

Laminas Project 47 Dec 22, 2022
Disable Google's FLoC with help of PSR-15 middleware

Disable Google's FLoC with PSR-15 middleware This package will help you disable Google's FLoC. Installation You can install the package via composer:

P7V 9 Dec 14, 2022
PSR-15 middleware to geolocate the client using the ip address

middlewares/geolocation ![SensioLabs Insight][ico-sensiolabs] Middleware to geolocate the client using the ip address and Geocoder and save the result

Middlewares 10 Mar 22, 2022
A PSR-15 middleware adapter for react/http

A PSR-15 middleware adapter for react/http Wraps PSR-15 middleware into coroutines using RecoilPHP making them usable within react/http as middleware.

Friends of ReactPHP 22 Nov 12, 2022
PSR-15 middleware to use Whoops as error handler

middlewares/whoops Middleware to use Whoops as error handler. Requirements PHP >= 7.2 A PSR-7 http library A PSR-15 middleware dispatcher Installation

Middlewares 31 Jun 23, 2022
PSR-15 compatible middleware for Whoops, the pretty error handler

PSR-15 middleware for Whoops A PSR-15 compatible middleware for Whoops, the fantastic pretty error handler for PHP. Installation You can install the l

Franz Liedke 25 May 20, 2022
An internal redirect mechanism for PSR-15 middleware stacks

HTTP Request Forwarder The aim of this library is to make it possible to pass the HTTP request to another handler, creating a so-called internal redir

Zoltan Kovago 0 Jul 27, 2022
Provides a Middleware to integration Tideways into Symfony Messenger Processing

Tideways Middleware for Symfony Messenger This package is currently under development and might be moved into the Tideways PHP Extension or stay indep

Tideways 6 Jul 5, 2022
A lightweight middleware to make api routing session capable.

Laravel stateless session A lightweight middleware to make api routing session capable. Installing $ composer require overtrue/laravel-stateless-sessi

安正超 17 Jul 6, 2022
Use middleware to decorate method calls within your application code.

Laravel Middlewarize ?? Chain of Responsibility Design Pattern In Laravel Apps ?? You can use middlewares to decorate any method calls on any object.

Iman 99 Jan 1, 2023
Stepup Middleware - This component is part of "Step-up Authentication as-a Service".

Step-up Middleware This component is part of "Step-up Authentication as-a Service". See Stepup-Deploy for an overview and installation instructions fo

OpenConext 4 Nov 2, 2022
Middleware to provide IP filtering

middlewares/firewall Middleware to provide IP filtering using M6Web/Firewall. Requirements PHP >= 7.2 A PSR-7 http library A PSR-15 middleware dispatc

Middlewares 10 Dec 1, 2022
A based PSR-15 microframework that also sets maximum flexibility with minimum complexity and easy replaceability of the individual components, but also of the framework.

chubbyphp-framework Description A based PSR-15 microframework that also sets maximum flexibility with minimum complexity and easy replaceability of th

chubbyphp 106 Dec 9, 2022
The efficient and elegant, PSR-7 compliant JSON:API 1.1 client library for PHP

Woohoo Labs. Yang Woohoo Labs. Yang is a PHP framework which helps you to communicate with JSON:API servers more easily. Table of Contents Introductio

Woohoo Labs. 160 Oct 16, 2022
OpenAPI(v3) Validators for Symfony http-foundation, using `league/openapi-psr7-validator` and `symfony/psr-http-message-bridge`.

openapi-http-foundation-validator OpenAPI(v3) Validators for Symfony http-foundation, using league/openapi-psr7-validator and symfony/psr-http-message

n1215 2 Nov 19, 2021
It validates PSR-7 messages (HTTP request/response) against OpenAPI specifications

OpenAPI PSR-7 Message (HTTP Request/Response) Validator This package can validate PSR-7 messages against OpenAPI (3.0.x) specifications expressed in Y

The League of Extraordinary Packages 421 Jan 3, 2023
Tukio is a complete and robust implementation of the PSR-14 Event Dispatcher specification

Tukio is a complete and robust implementation of the PSR-14 Event Dispatcher specification. It supports normal and debug Event Dispatchers, both runtime and compiled Providers, complex ordering of Listeners, and attribute-based registration on PHP 8.

Larry Garfield 70 Dec 19, 2022
The maker bundle allows you to generate content elements, front end modules

Contao 4 maker bundle The maker bundle allows you to generate content elements, front end modules, event listener, callbacks and hooks using interacti

Contao 7 Aug 3, 2022