After a period of private review, the uri-interop/interface package is now open for public review.

Uri-Interop publishes a standard set of interoperable URI interfaces for PHP 8.4+. It reflects, refines, and reconciles the common practices identified within several pre-existing projects.

The package defines separate interfaces to afford reading and modifying URI component values:

  • Uri affords reading of the URI component values and recomposing them into a string.
  • MutableUri extends Uri to afford direct modification of component values.
  • ImmutableUri extends Uri to afford immutable modification of component values.

Uri-Interop defines factory and parser interfaces:

  • UriFactory affords creating a new URI instance from URI component values.
  • UriParser affords creating a new URI instance from a URI string.

Uri-Interop defines these marker interfaces to codify expectations around RFC compliance:

Finally, Uri-Interop defines an interface of PHPStan type aliases, UriTypeAliases, to aid static analysis.

If you use URI objects (who doesn't!) and are interested an interoperable set of interfaces, please offer your comments and criticism as issues or pull requests out at Github.

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving you codebase, all while keeping it running the whole time.