Download the PHP package hq9000/php-rest-router without Composer

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

PHP REST router

A simple opinionated PHP framework for building API structures.

Motivation

In one of the proprietary projects I was working on, we needed to have a huge and complex REST api surface. Due to its dynamic nature and deep branching, it was considered suboptimal to go the normal "method per action" way.

What was needed is to be able to define a certain meta-structure and have the endpoints be just as a reflection of it.

Main concepts

The main concepts of the framework are the ones of:

Structure (a tree of nodes)

A Structure is represented by hq9000\PhpRestRouter\Structure class.

image

Structure is a unidirectional, acyclic graph of Nodes.

Each node, except the root one, has exactly one input node.

note: the arrows on the diagram above rather show the direction of the traversing, and not the direction of association.

Also, every node has associated:

Node traversing

The useful thing a structure makes possible is ability to traverse it.

Traversing is done by calling its public function trace($path, &$dataAccumulator), where:

The ultimate goal of traversing is to come up with two things:

the user of the framework may want to associate certain logic with these bits of information, but this is intentionally left out of scope of the framework.

Usage Example

This chapter gives a bit of human-readable explanation to complement reading the source code of CommonTest.php.

In that test, we pretend that the useful thing nodes can do is to hold certain tags. For that, we extend the Node class by DomainNode:

The structure of these nodes is shown on the simplified diagram below:

image

The test itself performs the "tracings" and checks their results, for example that class2/123123 results in the $idNode found as the final one and the data array appropriatelly populated with


All versions of php-rest-router with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5|7.*
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 hq9000/php-rest-router contains the following files

Loading the files please wait ....