laminas/laminas-diactoros

CLI command to register diactoros as pinned for `php-http/discovery`

boesing opened this issue · 1 comments

Feature Request

Q A
New Feature yes

Summary

With the most recent php-http/discovery v1.17.0 it is possible to pin PSR-17 and/or PSR-18 implementations in projects. I'd love to have a laminas-cli command which does that registration for me so that I do not have to do it manually.

The CLI command should:

  • modify composer.json to provide per-interface factory mapping
  • verify that php-http/discovery is installed
  • add force option to set the composer.json modifications even without php-http/discovery being installed
  • check if php-http/discovery is at least ^1.17 and output warning in case it is an older version

Example JSON configuration*

{
    "extra": {
        "discovery": {
            "Psr\\Http\\Message\\RequestFactoryInterface": "Laminas\\Diactoros\\RequestFactory",
            "...": "..."
        }
    }
}