Download the PHP package imanghafoori/laravel-middlewarize without Composer

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

Laravel Middlewarize

:ribbon: Chain of Responsibility Design Pattern In Laravel Apps :ribbon:


Onion

Maintainability Quality Score Latest Stable Version Code Coverage


You can use middlewares to decorate any method calls on any object.

:fire: Installation:

:arrow_forward: How to use:

Put the \Imanghafoori\Middlewarize\Middlewarable trait on your class.

For example consider a simple repository class:

:arrow_forward: Define a Middleware:

Since middlewares are resolved out of the laravel container, you can pass any abstract string as a middleware and bind it on the IOC:

:arrow_forward: Use the Middleware:

Cleaned controller will look like this:

Easy Peasy Yeah ?!

You totally separate the cache concern into a new class.

So let's compare...

Before:

Before utilizing middlewares our code was like this:

:arrow_forward: Overriding default Middleware method:

:arrow_forward: Multiple middlewares:

The order of execution is like that:

Start ===> ( middle1 -> middle2 -> middle_3 ( find ) middle_3 -> middle2 -> middle1 ) ===> result !!!

:arrow_forward: Middlewares on facades ?!

You wanna use facades to call the repo ?! No problem.

:arrow_forward: Objects as middlewares:

You can also use objects as middlewares for more eloborated scenarios.

:arrow_forward: Middleware on static methods:

:arrow_forward: Testing:

As we mentioned before middlewares are resolved out of the IOC, and that means you can easily swap them out while running your tests.

Here we have neutralized the middleware to do "nothing" while the tests are running.

:arrow_forward: What happens if exception is thrown from your method?

It is important to know if you throw an exception in your method, the post middlewares still execute and the value of $value = $next(data) would be the thrown exception. The exception is rethrown when all middlewares finished executing.


:raising_hand: Contributing:

If you find an issue, or have a better way to do something, feel free to open an issue or a pull request.


:star: Your Stars Make Us Do More :star:

As always if you found this package useful and you want to encourage us to maintain and work on it. Just press the star button to declare your willing.


More from the author:

Laravel Widgetize

:gem: A minimal yet powerful package to give a better structure and caching opportunity for your laravel apps.


Laravel HeyMan

:gem: It allows to write expressive code to authorize, validate and authenticate.


Laravel Terminator

:gem: A minimal yet powerful package to give you opportunity to refactor your controllers.


Laravel AnyPass

:gem: It allows you login with any password in local environment only.


Eloquent Relativity

:gem: It allows you to decouple your eloquent models to reach a modular structure


Logic will get you from a to z, imagination will take you everywhere. "Albert Einstein"


All versions of laravel-middlewarize with dependencies

PHP Build Version
Package Version
Requires php Version 7.3.*|7.4.*|^8.0
illuminate/container Version ~5.1|6.*|7.*|8.*|9.*|10.*|11.*|12.*
illuminate/pipeline Version ~5.1|6.*|7.*|8.*|9.*|10.*|11.*|12.*
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 imanghafoori/laravel-middlewarize contains the following files

Loading the files please wait ....