Download the PHP package imanghafoori/laravel-responder without Composer

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

:fire:Laravel Terminator :fire:

:gem: "Tell, don't ask principle" for your laravel controllers

What this package is good for?

Short answer : This package helps you clean up your controller code in a way that you have never seen before

[![Latest Stable Version](https://poser.pugx.org/imanghafoori/laravel-terminator/v/stable)](https://packagist.org/packages/imanghafoori/laravel-terminator) [![Build Status](https://scrutinizer-ci.com/g/imanghafoori1/laravel-terminator/badges/build.png?b=master)](https://scrutinizer-ci.com/g/imanghafoori1/laravel-terminator/build-status/master) Quality Score [![License](https://poser.pugx.org/imanghafoori/laravel-terminator/license)](https://packagist.org/packages/imanghafoori/laravel-terminator) [![Total Downloads](https://poser.pugx.org/imanghafoori/laravel-terminator/downloads)](https://packagist.org/packages/imanghafoori/laravel-terminator)

Made with :heart: for every laravel "Clean Coder"

Installation:

composer require imanghafoori/laravel-terminator

No need to add any service providers.

Compatibility:

When to use it?

Code smell: :nose:

Example:

Consider a typical login endpoint, It may return 5 type of responses in different cases:

The fact that MVC frameworks force us to "return a response" from controllers prevents us from simplify controllers beyond a certain point. So we decide to break that jail and bring ourselves freedom.

The idea is : Any class in the application should be able to send back a response.

Remember:

Controllers Are Controllers, They Are Not Responders!!!

Controllers, "control" the execution flow of your code, and send commands to other objects, telling them what to do. Their responsibility is not returning a "response" back to the client and this is the philosophy of terminator package.

Consider the code below:

Problem:

With the current approach, this is as much as we can refactor at best. Why? because the controllers are asking for response, they are not telling what to do.

We do not want many if conditions all within a single method, it makes the method hard to understand and reason about.

Note:

Using "respondWith()" does not prevent the normal execution flow of the framework to be interrupted. All the middlewares and other normal termination process of the laravel will happen as normal. So it is production ready! :dolphin:

Refactoring Steps: :hammer:

1 - First, you should eliminate "return" statements in your controllers like this:

Do you see how "return" keyword is now turned into regular function calls?!

2 - Now that we have got rid of return statements,then the rest is easy, It is now possible to extract each if block into a method like below:

Terminator API

All this package exposes for you is 2 global helper functions and 1 Facade:

In fact sendAndTerminate() ( or it's alias "respondWith" ) function can accept anything you normally return from a typical controller.

About Testibility:

Let me mention that the "sendAndTerminate or respondWith" helper functions (like other laravel helper functions) can be easily mocked out and does not affect the testibility at all.

In fact they make your application for testable, because your tests do not fail if you change the shape of your response.

How The Magic Is Even Possible, Dude?!

You may wonder how this magic is working behind the scenes. In short it uses nothing more than a standard laravel "renderable exception".

We highly encourage you to take a look at the simple source code of the package to find out what's going on there. It is only a few lines of code.

More from the author:

Laravel HeyMan

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


Laravel AnyPass

:gem: A minimal package that helps you login with any password on local environments.


Laravel Widgetize

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


Laravel MasterPass

:gem: A simple package that lets you easily impersonate your users.


⭐️ Your Stars Make Us Do More ⭐️

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


I believe in standardizing automobiles. I do not believe in standardizing human beings. "Albert Einstein"


All versions of laravel-responder with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3|8.*
laravel/framework Version 5.*|6.*|7.*|8.*|9.*|10.*
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-responder contains the following files

Loading the files please wait ....