, (*1)
MaintenanceBundle
The MaintenanceBundle
is a simple bundle that helps you to set your application in maintenance., (*2)
Installation
Step 1: Require the bundle with composer
Open your terminal and run one of the following commands to download the bundle into your vendor directory., (*3)
- If you have composer installed globally you can run:
$ composer require iulyanp/maintenance-bundle
$ php composer.phar require iulyanp/maintenance-bundle
Step 2: Register the bundle in your AppKernel class
Register the bundle in the app/AppKernel.php file of your project:, (*4)
<?php
/** app/AppKernel.php */
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
...
new Iulyanp\MaintenanceBundle\IulyanpMaintenanceBundle(),
);
}
}
Step 3: Import the bundle routes
iulyanp_maintenance:
resource: "@IulyanpMaintenanceBundle/Resources/config/routing.yml"
prefix: /
In order for the bundle to know when to set your website in maintenance you should configure it., (*5)
iulyanp_maintenance:
enabled: false
due_date: '14-10-2017 00:00:00'
layout:
signature: 'iulyanp'
title: We are in maintenance
description: Comming back soon...
You should use enabled and due_date configurations to chose when you want your application to be in maintenance and until what date.
You activate the maintenance by changing the enabled config to true but your website will be in maintenance only if you set the due date configuration., (*6)
The layout parameters are for changing the default title, message and signature from the default layout.
You can translate these configurations in the translation files., (*7)
Note! Do not forget to activate the translations on Symfony framework., (*8)
# config.yml
framework:
translator: { fallbacks: ["%locale%"] }
...