承接 devtia/maintenance-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

devtia/maintenance-bundle

最新稳定版本:0.2

Composer 安装命令:

composer require devtia/maintenance-bundle

包简介

README 文档

README

This bundle allows you to display a custom template when your site is under maintenance with a simple change in the parameters and a rapid deployment. This allows you to correct any errors in your application and inform your users almost immediately.

You can also define only some routes (with PHP regex) to display the message.

Installation

Download the Bundle.

composer require "devtia/maintenance-bundle"

Enable the Bundle

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new  Devtia\MaintenanceBundle\MaintenanceBundle(),
        );

        // ...
    }

    // ...
}

Usage

You need put something like this in your config.yml

maintenance:
  #default false. Set to true for enable the bundle and deploy your code
  enable_maintenance: false 
  #not required. You can set multiple routes and a custom template for each one. The routes must be compatible with PHP regex but without initial and end slash ('/')
  routes_prefixes:
    - ['\/admin\/', '%kernel.project_dir%/src/Resources/views/Maintenance/custom_maintenance.html.twig'] #if you left second parameter empty, the bundle use the default template
            

Template functionallity

The bundle provides a default template like this:

screenshot

You can create a custom template creating a file at this path:

ROOT_PATH_TO_YOUR_PROJECT . '/app/Resources/Devtia/MaintenanceBundle/views/maintenance.html.twig

If you want more control of your template or need more than one you can define multiple templates in the configuration.

Each template need to be related to a Regex for a group of routes. In the configuration example, the bundle shows the custom_maintenance.html.twig template in all routes that match with 'admin' pattern.

Regex

You can learn about PHP regex in this link and try them here.

The MaintenanceBundle simplifies the configuration add to ALL your routes_prefixes the initial and end slash ('/') and the wildcard .* at the end. With the configuration example shows above, the bundle create this regex:

/\/admin\/.*/

This example match with routes like '/admin/', '/admin/login', '/admin/users/create',...

Contact

You can contact with me on jaime@devtia.com.

统计信息

  • 总下载量: 6.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-04