Download the PHP package lighthouse/router without Composer

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

Lighthouse Router

A fast, simple HTTP router for the Lighthouse framework.

Installation

Requirements

Features

Quick Start

Basic Routing

Route Parameters

Parameters are defined with curly braces and automatically extracted:

Route Groups

Group routes with a common prefix:

Nested groups:

Named Routes

Name routes for URL generation:

Multiple Methods

Dispatching Requests

With PSR-7 request:

Or directly with method and path:

Exception Handling

RouteNotFoundException

Thrown when no route matches the request path:

MethodNotAllowedException

Thrown when the path matches but the HTTP method doesn't:

API Reference

Router

Method Description
get(string $path, mixed $handler) Register GET route
post(string $path, mixed $handler) Register POST route
put(string $path, mixed $handler) Register PUT route
patch(string $path, mixed $handler) Register PATCH route
delete(string $path, mixed $handler) Register DELETE route
options(string $path, mixed $handler) Register OPTIONS route
head(string $path, mixed $handler) Register HEAD route
any(string $path, mixed $handler) Register route for all methods
match(array $methods, string $path, mixed $handler) Register route for specific methods
group(string $prefix, callable $callback) Create route group
dispatch(ServerRequestInterface $request) Match PSR-7 request
matchRoute(string $method, string $path) Match method and path
url(string $name, array $params) Generate URL for named route
getRoutes() Get all registered routes
clear() Remove all routes

Route

Method Description
getMethod() Get HTTP method
getPath() Get route path
getHandler() Get route handler
getName() Get route name
name(string $name) Set route name
getParameters() Get extracted parameters
matches(string $method, string $path) Check if route matches
generateUrl(array $params) Generate URL with parameters

RouteMatch

Method Description
getRoute() Get matched route
getHandler() Get route handler
getParameters() Get all parameters
getParameter(string $name, ?string $default) Get single parameter

Testing

License

MIT License. See LICENSE for details.

Part of the Lighthouse Framework

This package is part of the Lighthouse Framework, an educational PHP framework designed to teach how modern frameworks work internally.


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
psr/http-message Version ^2.0
psr/http-server-handler 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 lighthouse/router contains the following files

Loading the files please wait ...