Download the PHP package louiss0/slim-route-registry without Composer

On this page you can find all versions of the php package louiss0/slim-route-registry. 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 slim-route-registry


aliases: [slim-route-registry-library] tags: [slim, route-registry] note type: Main

Slim Route Registry

Usage

The slim route registry library is a library that uses controllers and the metadata that comes from them to automatically create route groups and setup middleware. The controller is used as the model for how routes are created and what methods they use. This library is created for slim php only.

Installation

Setup

To setup the library you have to first create the slim app and pass it into the setup method.

Doing this will setup all of the systems necessary to create controllers called "Resource Controllers"

Sections

Resources

A Resource Controller is a controller that either has a route method attribute attached to a method or uses a Automatic Registration Method. It's a controller with the necessary information needed for the Resource method to work. To create a resource you create a class then attach a Route Method Attribute to one of its methods.

Manual Resources

A Manual Resource is a controller that is created by attaching route method attributes as to its methods. The route attributes will tell the RouteMethodAttribute is the main attribute all other attributes stem inherit from this attribute with a predefined http request method.

A route method attribute is an attribute that takes three parameters.

Note you don't need to use the Route Method Attribute directly you can use Attributes that are inherited from them instead.

Automatic Resources

An Automatic Resource is a controller that uses a Automatic Registration Method.

An Automatic Registration Method is a method that has a name that will be used by the resource method to register a route based on it's name.

Note: If you add a route method attribute to one of these methods you'll get an error

Note: The id parameter must be an int

Group Scoping

In most apps you want to have the power to wrap resources under a group that will be be used to either call middleware before any of their methods are called or controlling the path the user must use to access a resource. To do this you use the group method.

Middleware

You can use middleware in your app by using Use Middleware Attributes on methods and controllers and controller methods. You can tell the resource method to create the same middleware to be called before a request handler is called or before multiple request handlers are called.

Resource Middleware

To apply middleware to a route group created from the resource method you use the Use Middleware Attribute on a controller.

Method Middleware

When it comes to putting middleware in a route you must use a class that implements the Middleware interface as a attribute or the following attributes on a controller:

Note: The middleware will be applied in the following order.

  1. UseMiddlewareOn
  2. UseMiddlewareExceptFor

Note: The UseMiddlewareOn and Use UseMiddlewareExceptFor attributes are repeatable

Group Middleware

To add middleware to a group use the created by the RouteRegistry::group() method use


All versions of slim-route-registry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
slim/psr7 Version ^1.4
slim/slim Version ^4.7.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 louiss0/slim-route-registry contains the following files

Loading the files please wait ....