Download the PHP package filippo-toso/uri without Composer

On this page you can find all versions of the php package filippo-toso/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

URI

A simple class to easily manipulate URLs.

Requirements

Installing

Use Composer to install it:

Basic usage

You can create an instance of the URI class using the static make() or through its constructor:

You can also pass other optional parameters that will be used when creating the querystring part of the URL. Check the source code for more details.

Once you have an instance of the class, you can use its fluent API to manipulate the URL as you like.

For instance, let's change the schema and domain:

You can call the following methods to get/set the relative parts of the URL: scheme(), user(), pass(), host(), port(), path(), query() and fragment().

For instance, let's get the domain:

The class can be casted to string to get the whole url or you can use the url() method as shown above. You can also get the unmodified url using the original() method.

More complex usage

Now let's do something more complex, for instance, let's change an url through a relative path.

The parameter passed to the relative() method can be a full URL (in this case the whole URL will be replaced with the new one), an absolute path or a relative path. It can also include the querystring and the fragment.

You can also change only the extension of the file using the extension() method or replace the querystring using the params() method (it accepts an array of parameters as input) or the query() (it accepts a string as input).

Querystring manipulation

Talking about querystring manipulation, there are other useful methods to do that. For instance, you can use:

All these methods accept a dot notation as the key name. For instance, to change the a parameter like $_GET['post']['content']['html'] you will use the dot notation post.content.html.

Talking about the remove() method, instead of a key, you can pass it a callback to remove multiple elements in one go. For instance, here's the code to remove all the utm_* parameters used to track campaigns in Google Analytics:

That's it, go change the URLs!.


All versions of uri with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.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 filippo-toso/uri contains the following files

Loading the files please wait ....