Download the PHP package f9webltd/laravel-redirect-response-macros without Composer

On this page you can find all versions of the php package f9webltd/laravel-redirect-response-macros. 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-redirect-response-macros

Packagist Version Run Tests StyleCI Status Packagist License

Laravel Redirect Response Macros

Some super useful redirect response macros to simplify your Laravel application.

Requirements

Legacy Support

For legacy PHP / Laravel support, use package version 1.1.6

Installation

The package will automatically register itself.

Optionally publish language files by running: php artisan vendor:publish and selecting the appropriate package.

Documentation

This package allows for concise controller redirections by setting default flash data. It works as Laravels RedirectResponse class is "macroable".

For example the packages allows:

... instead of:

The former is of course much more concise and readable.

The package specifies several custom RedirectResponse macros that can be used on any of the native Laravel helpers that return the redirect response object.

The following methods are available.

success()

Flash message key: success
Pass a message string to the macros.

info()

Flash message key: info
Pass a message string to the macros.

danger()

Flash message key: danger
Pass a message string to the macros.

warning()

Flash message key: warning
Pass a message string to the macros.

There are further helper method available, that set the same type of flash data, but in a more readable manner:

created()

Flash message key: success
Default message: The record was successfully created

Alternatively pass a url to display an message with a link to view the created record:

The flashed message will now be: The record was successfully created. <a href="/posts/1/edit" class="alert-link">View inserted record</a>.

updated()

Flash message key: success
Default message: The record was successfully updated

To set a custom message, pass the desired text to the updated() function.

deleted()

Flash message key: success
Default message: The record was successfully deleted

To set a custom message, pass the desired text to the deleted() function.

error()

Flash message key: error
Specific message text should be passed.

The function can detect the presence of exception object and call getMessage() as required:

errorNotFound()

Works in the same way as the error() macro and is intended to make controllers more concise.

The default message is Sorry, the record could not be found..

authorized()

Flash message key: success
Default message: Welcome back, you have been securely logged in

A custom message can optionally be provided.

unAuthorized()

Works in the same way as the error() macro and is intended to make controllers more concise.

The default message is You do not have permission to perform that action.

IDE Autocompletion within PHPStorm

Autocompletion of "macroable" classes with PHPStorm currently difficult, which is a shame given how useful macroable classes actually are.

At present, the following process will trigger autocompletion in PHPStorm:

Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests.

Testing

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of laravel-redirect-response-macros with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.12|^9.0|^10.0|^11.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 f9webltd/laravel-redirect-response-macros contains the following files

Loading the files please wait ....