juniwalk/shield

This package is abandoned and no longer maintained. No replacement package was suggested.

Maintenance manager for Nette Framework

v1.3.2 2015-03-07 21:28 UTC

This package is auto-updated.

Last update: 2019-02-20 19:59:34 UTC


README

Travis GitHub Releases Total Donwloads Code Quality Tests Coverage License

Simple, yet powerfull library for Nette Framework that will help you block access of unauthorized visitors when in maintenance mode, all this based on listed IP addresses.

Abandoned

After some usage I came to realize that this tool makes more problems than it solves.

Installation

Best way to install Shield is using composer.

$ composer require juniwalk/shield:~1.3

Usage

Add Shield configuration to your config.neon file.

extensions:
    shield: JuniWalk\Shield\DI\ShieldExtension

shield:
    enabled: true
    debugger: true
    autorun: true
    actions:
        output: "Forbidden! 403"
        include: %appDir%/tmp/maintenance.html
        redirect: /tmp/maintenance.html
        callback: {@service, method} #will receive instance of Shield
        abort: 255 #status code
    hosts:
        - 127.0.0.1     # Local IPv4
        - ::1           # Local IPv6

That's it!

Actions

  • Include: Include any file you wish.
  • Redirect: Redirect to given url.
  • Output: Print out given text directly.
  • Callback: Given callback will be invoked.
  • Abort: Code execution is aborted.

You can use all above mentioned actions one time, but do not use Output and Redirect in that order as headers will be send and redirect will fail. You can also leave the action empty to take no action.

Abort action is called automatically with status code 0 if you don't add it yourself.