Download the PHP package laniakea/middleware-priority without Composer

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

Middleware priority manager for Laravel 11+

Latest Version on Packagist Tests Total Downloads

This package provides more flexible way to manage HTTP middleware priority in Laravel 11+ applications.

Please note that this package only compatible with fresh Laravel 11+ applications (or applications that have been upgraded to Laravel 11+ with new directory structure / application bootstrapping).

You can simply append/prepend your middleware to the priority list or do more complex things, such as:

This package provides default Laravel's priority list (latest update: Laravel 11.0.7; check DefaultMiddlewarePriority class), so you can use it as a base for your custom priority list.

Installation

You can install the package via composer:

Usage

This package is intended to be used with Laravel's Application::configure() builder (located in bootstrap/app.php file).

Create priority manager

Create new instance of Laniakea\MiddlewarePriority\MiddlewarePriorityManager inside withMiddleware callback to start using middleware priority manager. Please note that the priority list will be empty by default (unless you mutated it before creating manager instance).

Use Laravel's default priority

If you want to use Laravel's default priority list, you can use static MiddlewarePriorityManager::withDefaults method to create manager instance with default priority list.

Second argument to the withDefaults() method accepts user-defined list of default middleware priority (if it's null or was not passed, default Laravel's priority list will be used).

Appending middleware

Here and below it's assumed that manager created & used inside the withMiddleware callback.

Use append(string|array $middleware) method to append middleware to the priority list.

Prepending middleware

Use prepend(string|array $middleware) method to prepend middleware to the priority list.

Add middleware before specific middleware

Use before(string $middleware, string|array $newMiddleware) method to add middleware before specific middleware.

Also you can use array of middleware as a second argument. In this case new middleware will be added according to the order in the array.

Add middleware after specific middleware

Use after(string $middleware, string|array $newMiddleware) method to add middleware after specific middleware.

Also you can use array of middleware as a second argument. In this case new middleware will be added according to the order in the array.

Swap middleware positions

Use swap(string $what, string $with) method to swap positions of two middleware.

Remove middleware

Use remove(string|array $what) method to remove middleware from the priority list.

Also you can use array of middleware. All listed middleware will be removed from the priority list.

After removing middleware from the priority list, it's position will be determined by the order of registration in the group middleware. See example below.

Get current priority list

If you need to retrieve current priority list, you can use getPriority() method.

Complete example

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of middleware-priority with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 laniakea/middleware-priority contains the following files

Loading the files please wait ....