Download the PHP package soflomo/staging-bar without Composer
On this page you can find all versions of the php package soflomo/staging-bar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download soflomo/staging-bar
More information about soflomo/staging-bar
Files in soflomo/staging-bar
Package staging-bar
Short Description A staging bar notification for Zend Framework 2 projects
License BSD-3-Clause
Homepage https://github.com/Soflomo/StagingBar
Informations about the package staging-bar
Soflomo StagingBar
The Soflomo StagingBar is a very small Zend Framework 2 module rendering a notification bar at the top of every page. The bar is meant for staging environment to inform visitors the website is only meant for testing purposes and should not be confused with the production version.
Installation
Add "soflomo/staging-bar" to your composer.json file and update your dependencies. Enable
Soflomo\StagingBar in your local application.config.php
.
If you do not have a composer.json file in the root of your project, copy the
contents below and put that into a file called composer.json
and save it in
the root of your project:
Then execute the following commands in a CLI:
Now you should have a vendor
directory, including a soflomo/staging-bar
. In your
bootstrap code, make sure you include the vendor/autoload.php
file to properly
load the Soflomo StagingBar module.
Local application configuration
This module is the easiest to load via a local application configuration file. This means that just like "local" files in the config/autoload
, you can also enable application on a local level. To achieve this, replace your application.config.php
with the following file:
Then create a local dist
file which acts as a template for all local installations, called application.config.local.php.dist
:
Then copy this dist file to remove the .dist
extension. Commit the new application config and dist file into your versioning system and make sure to ignore the local application configuration.
Now you can easily enable Soflomo\StagingBar
in your local application configuration without the struggle to disable it on your development or production versions.
Custom staging bar
You can override the template used to render this bar. Just create a view script that resolves to soflomo-staging-bar/partial/staging-bar.phtml
and that file will be rendered. Note the bar contains some inline styles to render the bar correctly. If you override the template, it is suggested to copy these styles as well.
If you do not want to render a script with this long template name, you can use the template
key in the configuration to modify the location of the template:
Custom variables
In your own template, you can inject variables to ease configuration of the bar. The variables
key in the configuration is mapped to variables in the view model:
If you call $foo
in your template, it will echo bar
.