Download the PHP package byjg/uri without Composer

On this page you can find all versions of the php package byjg/uri. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package uri


sidebar_key: uri sidebar_category: http-apis tags: [php, http]

PSR-7 URI Implementation

A PSR-7 URI that also works as a connection string: the object behind the mysql://, amqp:// or s3:// URIs of the ByJG components.

Sponsor Build Status Opensource ByJG Install MCP Server GitHub source GitHub license GitHub release

Why

Connection strings look like URIs, but a strict PSR-7 implementation mangles them: it cannot represent a host and port without a scheme (kafka:9092), and it percent-encodes the path, which a driver reads as a name (a file, a database). Passwords with special characters need encoding by hand.

This URI keeps what a connection string needs, and adds what PSR-7 leaves out:

The same class reads the connection strings of the ByJG components (databases, NoSQL stores, message queues, mail, HTTP), so a connection is always configured the same way.

Features

PSR-7 differences

The URI is also used for connection strings (mysql://host:3306/db, h:9092), so some PSR-7 rules are not followed:

The standard port of http (80) and https (443) is left out, as PSR-7 requires: https://host:443 has the port null and is written https://host. The port of any other scheme is kept (mysql://db:3306).

URI Encoding Behavior

PSR-7 requires URI compliant with RFC3986. This means the URI output will always be URL encoded. This applies to both creating a new instance and the string representation.

Examples:

Additional Methods

This implementation extends PSR-7 UriInterface with the following additional methods through \ByJG\Util\CustomUriInterface:

Method Description
getUsername(): ?string Get the decoded username of the URI
getPassword(): ?string Get the decoded password of the URI
getQueryPart(string $key): ?string Get a specific query parameter by key
getQueryParts(string $key): array Get every value of a query parameter
withQueryKeyValue(string $key, string $value, bool $isEncoded = false): self Add or update a query parameter
hasQueryKey(string $key): bool Check if a query parameter exists

Static Factory Methods

The class provides convenient static factory methods:

Code that receives a PSR-17 UriFactoryInterface gets the same Uri from UriFactory:

Documentation

Installation

Running Tests

The PSR-7 and PSR-17 conformance suites, the ones other implementations run (php-http/psr7-integration-tests and http-interop/http-factory-tests), are part of the run. The tests of the PSR-7 differences are skipped with the reason (tests/Conformance/UriIntegrationTest.php).


Open source ByJG


All versions of uri with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3 <8.6
psr/http-message Version ^1.0|^1.1|^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package byjg/uri contains the following files

Loading the files please wait ...