Download the PHP package gmazzap/url-to-query without Composer

On this page you can find all versions of the php package gmazzap/url-to-query. 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 url-to-query

Url To Query

A WordPress plugin that allow resolving any kind of WordPress url (even from custom rewrite rules) to related main query arguments.

Requirements

Installation

The plugin is a Composer package and can be installed in plugin directory via:

What & Why

WP comes with a set of tools to convert custom urls into specific query variables: is possible to change the permalink structure, and there is also an API to add completely custom rules, however, there is not a way to reverse the process: i.e. to know to which query arguments an arbitrary url is connected to.

The url resolving is done in core by parse_request method of WP class saved in the global $wp variable.

Using that method for the purpose explained above is hard/discouraged because:

This is the reason why I wrote this simple plugin, it adds a template tag url_to_query that accepts an url and returns related main query arguments.

How to use

It is also possible to pass a relative url:

Using query string

When pretty permalinks are not used, (sometimes even in that case) WordPress can make use of query string in the urls to set query arguments. The plugin works perfectly with them:

To simplify this task, url_to_query accepts a second argument: an array of query vars to be considered in the same way core considers $_REQUEST variables when an url is parsed:

Note that the array passed as second argument is not straight merged to the query vars, only valid query vars will be used, just like core does when parse urls:

Custom rewrite rules

Plugin works with no problems with custom rewrite rules, just few things to consider:

Example:

Plugin classes

Even if plugin provides the 'url_to_query' template tag, it internally uses two classes to resolve urls and it is possible directly use them, instead of the template tag. Indeed, only one of them should be used, the second is used internally.

So resolve() method of GM\UrlToQuery works exactly in the same way url_to_query function does.

The same instance of GM\UrlToQuery can be used to resolve different urls:

================

License

Url_To_Query is released under MIT.


All versions of url-to-query with dependencies

PHP Build Version
Package Version
Requires composer/installers Version ~1.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 gmazzap/url-to-query contains the following files

Loading the files please wait ....