Download the PHP package tandrezone/zroute without Composer

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

zRoute

A simple, lightweight PHP routing system available as a Composer package.

Features


Requirements


Installation


Quick Start


Route Syntax

Dynamic segments start with $ (legacy) or are wrapped in { } (recommended for array definitions). The parameter name may contain letters, digits, underscores _, and hyphens -.

Pattern Example URL Extracted params
/about /about []
/users/$id /users/42 ['id' => '42']
/users/{id} /users/42 ['id' => '42']
/products/$product-slug /products/red-sneakers ['product-slug' => 'red-sneakers']
/users/{userId}/posts/{postId} /users/7/posts/99 ['userId' => '7', 'postId' => '99']

Dynamic segments match one path segment only (they never cross a /).


Array-Based Route Loading

Define routes as a PHP array and load them all at once. This enables separation of route definitions from bootstrap code and is the recommended approach for Composer packages.

Route Definition Schema

Loading from an Array

Loading from a File

The file must return a PHP array of route definitions:

Config-Driven Paths

A path like config[namespace.key] is resolved against a $config array supplied at load time:


Middleware

Each middleware class must implement zRoute\Contracts\MiddlewareInterface:

Middleware declared first in the array wraps middleware declared later (standard onion model).


Parameter Validation

Route parameters are validated and type-cast automatically when a parameters block is present. The validated, typed values are available on the Request object passed to the controller.

Supported types: string, integer, float, boolean, array.

A zRoute\Exceptions\ValidationException is thrown if validation fails. Catch it in your error handler to return a structured HTTP 422 response.


Request Object

Controllers loaded via loadFromArray() / loadFromFile() receive a zRoute\Request instance:


API Reference

Registering routes (fluent API)

Array-based loading

Named routes

Error handlers

Dispatching


Full Example

See examples/index.php for the classic fluent API and examples/routes.php for a complete array-definition example.


Web Server Configuration

Apache (.htaccess)

Nginx


Running the Tests


License

MIT


All versions of zroute with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 tandrezone/zroute contains the following files

Loading the files please wait ...