Download the PHP package havokinspiration/wrench without Composer

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

Wrench : CakePHP 3 Maintenance mode plugin

Build Status codecov.io

Wrench is a CakePHP 3.X plugin that aims to provide an easy way to implement a Maintenance Mode for your CakePHP website / applications.

Requirements

About the plugin versions

CakePHP < 3.3.0 CakePHP >= 3.3.0 CakePHP >= 3.5.0
Wrench 1.X Wrench 2.X Wrench 3.X
PHP >= 5.4.16 PHP >= 5.5.9 PHP >= 5.6.0
Uses CakePHP DispatcherFilter mecanism Uses CakePHP Middleware Stack and PSR-7 Request / Response implementation Uses CakePHP Middleware Stack and PSR-7 Request / Response implementation + no deprecation warning from CakePHP 3.6.X

Recommanded package

If you want to create your own maintenance mode, you can use the CakePHP 3 Bake plugin

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

Loading the plugin

You can load the plugin using the shell command:

Or you can manually add the loading statement in the boostrap.php file of your application:

Usage

The plugin is built around a Middleware that will intercept the current request to return a customized response to warn the user that the website / app is undergoing maintenance.

To use the Maintenance mode, you need to add the MaintenanceMiddleware to the MiddlewareStack in your Application file by adding the following elements :

Since this Middleware is here to prevent the application from responding, it should be the first to be treated by the Dispatcher and should, as such, be configured as the first one, either by adding it in the beginning of the method with the push() method or using the prepend() method anywhere you want in your middlewares configuration.

By default, only adding it with the previous line will make use of the Redirect mode. More informations on maintenance Modes below.

The Middleware is only active when the Configure key Wrench.enable is equal to true. To enable the maintenance mode, use the following statement in your bootstrap.php file :

Modes

The plugin is built around the concept of "modes". Modes are special classes which will have the task of processing the request and return the proper response in order to warn the user that the website / application is undergoing maintenance.

The plugin comes packaged with four maintenance modes : Redirect, Output, Callback and View.

You can configure it to use specific modes when adding the Middleware to the Middleware stack by passing parameters to the Middleware constructor. The will result in a call looking like this :

If you need it, you can directly pass an instance of a Mode to the mode array key of the filter's config:

IP Whitelisting

While you put your application under maintenance, you might want, as the project administrator or developer, to be able to access the application. You can do so using the IP whitelisting feature. When configuring the MaintenanceMiddleware, just pass an array of allowed IP addresses to the whitelist key in the Middleware configuration array. All those IP will be allowed to access the application, even if the maintenance mode is on:

In the above example, clients connecting with the IP address 1.2.3.4 or 5.6.7.8 will be able to access the project, even if the maintenance mode is on.

Redirect Mode

The Redirect Mode is the default one. It will perform a redirect to a specific URL. The Redirect Mode accepts the following parameters :

You can customize all those parameters :

Output Mode

The Output Mode allows you to display the content of a static file as a response for the maintenance status. It accepts multiple parameters :

You can customize all those parameters :

Callback Mode

The Callback Mode gives you the ability to use a custom callable. It accepts only one parameter callback which should be a callable. The callable will take two arguments :

The callable is expected to return a \Psr\Http\Message\ResponseInterface if the request is to be stopped.

View Mode

The View Mode gives you the ability to use a View to render the maintenance page. This gives you the ability to leverage helpers and the layout / template system of the framework. It accepts multiple parameters :

Creating a custom mode

If you have special needs, you can create your own maintenance mode. To get started quickly, you can use the bake console tool to generate a skeleton:

This will generate a MyCustomMode class file under the App\Maintenance\Mode namespace (as well as a test file). Your skeleton will only contain one method process() returning a \Psr\Http\Message\ResponseInterface object. This is where the logic of your maintenance mode goes. You can either make the method return a ResponseInterface object which will shortcut the request cycle and use the returned ResponseInterface object to respond to the request. Any other returned value will make the maintenance mode no-op and the request cycle will go on. This is useful if you need to display the maintenance status only on specific conditions.

The Mode implements the InstanceConfigTrait which allows you to easily define default configuration parameters and gives you easy access to them.

Keep in mind that the ResponseInterface you need to return is PSR-7 compliant. You can get more details about the implementation and how to interact with it on the PHP-FIG website as well as on the CakePHP documentation

You can check out the implemented modes to have some examples.

Conditionally applying the maintenance mode

Conditionally applying a middleware is currently not possible with the current implementation of the Middleware stack in CakePHP 3.3. A documentation on how to do this will be added when and if this feature is implemented in the core.

Contributing

If you find a bug or would like to ask for a feature, please use the GitHub issue tracker. If you would like to submit a fix or a feature, please fork the repository and submit a pull request.

Coding standards

Since this plugin is tangled with features from the CakePHP Core and to provide consistency, it follows the CakePHP coding standards. When submitting a pull request, make sure your code follows these standards. You can check it by installing the code sniffer :

And then running the sniff :

License

Copyright (c) 2015 - 2017, Yves Piquel and licensed under The MIT License. Please refer to the LICENSE.txt file.


All versions of wrench with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
cakephp/cakephp Version ^3.5
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 havokinspiration/wrench contains the following files

Loading the files please wait ....