承接 kurl/silex-error-template-provider 相关项目开发

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

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

kurl/silex-error-template-provider

最新稳定版本:0.1.0

Composer 安装命令:

composer create-project kurl/silex-error-template-provider

包简介

Error templates for silex

README 文档

README

Version: 0.1.0

A Silex error provider copied almost verbatim from the example in the Silex Skeleton.

Usage

The example templates rely on a layout twig file names layout.html.twig, to use these default files this template must exist somewhere in the twig path.

Example

<?php

$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider());
$app['twig'] = $app->share($app->extend('twig', function ($twig, $app) {
    $path = __DIR__ . '/../vendor/kurl/silex-error-template-provider';
    $twig['path'] = array(
        $path . '/src/Resources/views' // The path to the default error templates
        $path . '/tests/Fixture/example' // The path to the example layout.html.twig
    );
    return $twig;
}));

$app->register();

The default template suffix .html.twig can be overridden by setting the kurl.error.template_suffix value;

<?php

$app['kurl.error.template_suffix'] = '.html';

Extending/customising

To provide customised templates for specific error codes extra templates can be created in the fashion error/{code}.{suffix} in the twig path.

If a custom template was required for all 41x errors then all that is required is a template named error/41x.{suffix} in the twig path.

To use a different set of templates to those supplied simply copy the contents of the src/Resources/views/error directory to new sub directory also named error and add that new directory to the twig path either before or instead of the default path and make any modifications required to the new templates.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-11