Download the PHP package rareloop/wp-router without Composer

On this page you can find all versions of the php package rareloop/wp-router. 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 wp-router

This package is no longer supported. Use at your own risk. We recommend using the underlying router: https://github.com/Rareloop/router

Rare WordPress Router

CI

A WordPress wrapper around the Rareloop PHP Router. Easily handle custom endpoints on your WordPress site with this plugin.

Installation

Although not a requirement, using Composer and a setup like Bedrock is the recommended installation method.

Usage

Creating Routes

Map

Creating a route is done using the map function:

map() takes 3 parameters:

Route Parameters

Parameters can be defined on routes using the {keyName} syntax. When a route matches that contains parameters, an instance of the RouteParams object is passed to the action.

Named Routes

Routes can be named so that their URL can be generated programatically:

If the route requires parameters you can be pass an associative array as a second parameter:

HTTP Verb Shortcuts

Typically you only need to allow one HTTP verb for a route, for these cases the following shortcuts can be used:

Setting the basepath

The router assumes you're working from the route of a domain. If this is not the case you can set the base path:

Controllers

If you'd rather use a class to group related route actions together you can pass a Controller String to map() instead of a closure. The string takes the format {name of class}@{name of method}. It is important that you use the complete namespace with the class name.

Example:

Creating Groups

It is common to group similar routes behind a common prefix. This can be achieved using Route Groups:


All versions of wp-router with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
rareloop/router Version ^1.0.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 rareloop/wp-router contains the following files

Loading the files please wait ....