Download the PHP package pivotphp/core-routing without Composer

On this page you can find all versions of the php package pivotphp/core-routing. 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 core-routing

PivotPHP Core Routing

PHP Version PSR-7 PSR-15

Simple, focused routing engine for PivotPHP with an Express.js-inspired API. It does one thing well: register routes, compile patterns and match paths — no caching, no plugins, no premature optimization.

Features

Installation

Quick Start

Handlers

Supported handler syntaxes: Closure, named functions, or array callables [Class::class, 'method']. The legacy 'Controller@method' string format is not supported.

Static files

The last argument is the router that receives the routes; registering the same directory in another router publishes the files there too.

Each file becomes a GET route when the directory is registered. Only files with an allowed extension are published; hidden files and anything inside hidden directories (.env*, .git/, .well-known/) are never published, and symlinks are followed only when their target stays inside the directory. Register routes explicitly for files you need from a hidden path (e.g. /.well-known/...).

API reference

Router (instance)

Method Description
add($method, $path, $handler, $metadata = [], ...$middlewares) Register a route.
get/post/put/delete/patch/options/head/any($path, $handler, ...) HTTP verb shortcuts.
match($methods, $path, $handler, ...) Register the same handler for several methods.
group($prefix, $callback, $middlewares = []) Register a route group.
use($prefix, ...$middlewares) Attach middlewares to routes registered afterwards whose path starts with $prefix; does not change route paths.
addHttpMethod($method) Register an additional HTTP method.
identify($method, $path) Match a route; returns the route array or null.
allowedMethods($path) Methods that have a route for $path.
Router::compilePattern($path) (static) Compile a path to regex + parameter list.
Router::isStaticRoute($path) (static) Whether a path has no parameters.
getRoutes() All registered routes.
getHttpMethodsAccepted() Accepted HTTP methods.
clear() Clear this router's routes/state.

Migrating from 2.x

In 2.x every method was static and all code shared one global route table. In 3.0 create a Router and call the methods on it. For code that cannot be migrated at once, the deprecated RouterFacade forwards static calls to one shared instance (RouterFacade::get(...), Router::default()), which keeps the old global behaviour.

Requirements

Testing

License

MIT License - see LICENSE file for details.

Community

Credits

Created by Caio Alberto Fernandes and the PivotPHP community.

Inspired by Express.js routing and built with modern PHP best practices.


All versions of core-routing with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/http-message Version ^1.1|^2.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 pivotphp/core-routing contains the following files

Loading the files please wait ...