Download the PHP package triplepoint/groundhog-router without Composer

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

Groundhog Router

Build Status

Introduction

This library provides a request router which can interpret incoming requests, determine to what class the request maps, and return the action handler class ready for execution.

Dependencies are kept to zero, with interfaces provided for extension points.

Disclaimer

While I take great care to produce code that is free of excess dependencies and short-sighted assumptions, I feel I should warn you that this code is not primarily meant for public consumption. In other words, please understand that if you want to use this code in your own work you're free to do so under the provided license, but I'm not promising that the API will be stable or that the code will necessarily meet your needs out of the box.

So please, feel free to fork this code and adapt it to your own needs - or even better, offer comments on how I could improve the general-purpose nature of the code. But also accept that at the end of the day, this really is just a starting place for your own work.

Basic Structure

There are 3 core components in this library: the Router, a Route Parser, and a Routing Table Store. There are several secondary elements that get passed around as messages or used as helpers: RequestInterface, Route, etc. Finally, the end result is some object that implements RouteHandlerInterface.

Router

The Router takes in an object that represents the incoming request and which implements RequestInterface. This request is then delegated to the Routing Table Store in an attempt to find a matching Route. Once the Route is found, the Router constructs the appropriate object that implements RouteHandlerInterface, which is a Controller in typical framework terminology.

Route Parser

A Route Parser is any object that implements RouteParserInterface. It's responsibility is to acquire the set of Routes to which the project can respond. This is intentionally abstract - the included RouteParserAnnotation Route Parser operates on a set of phpdoc attributes to determine the Routes, but any strategy of route encoding could be used, with an appropriate Route Parser written to interpret it.

Routing Table Store

A Routing Table Store implements RoutingTableStoreInterface, and represents a cache in which to store the routing table once the Route Parser generates the set of Routes. There are Routing Table Stores included to support APC and SQLite, and a special "NoCache" Store which does not cache at all and instead prompts the Route Parser to always regenerate the routing table. Alternative storage mechanisms can easily be added by implmenting new objects against RoutingTableStoreInterface.

RequestInterface

Objects that implement the RequestInterface represent the incoming request. There generally need only be one of these implemented, and in an attempt to remain independant of other libraries, it is left to the user to implement this object. The methods defined in RequestInterface are generally based on Symfony's Http-Foundation library, but anything that properly implements this interface is valid.

Route

This object represents a single route rule, and is used as a messenger container between the Router, Route Parser, and Routing Table Store.

RouteHandlerInterface

These objects are the traditional controllers in MVC architecture. In an attempt to contain dependencies while allowing for testing, these objects can announce their preferred dependency injection container which is then passed back to them for consumption. Also, these objects are loaded by the Router with any incoming request's call parameters that may be present.

Example

First, lets define some classes that must be implemented:

Now that these classes are defined, we can set up the router and use it.

In practice, a lot of the creation and configuration of the various dependencies can be moved into a depdency container, leaving a clean startup in index.php.


All versions of groundhog-router with dependencies

PHP Build Version
Package Version
No informations.
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 triplepoint/groundhog-router contains the following files

Loading the files please wait ....