定制 slepic/templated-tracy-bar-panel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

slepic/templated-tracy-bar-panel

最新稳定版本:0.2.1

Composer 安装命令:

composer require slepic/templated-tracy-bar-panel

包简介

Generic implementaton of Tracy\IBarPanel which allows you to implement IBarPanel factory classes instead of implementing IBarPanel directly.

README 文档

README

Build Status Style Status

templated-tracy-bar-panel

A simple implementation of Tracy\IBarPanel that allows you to create custom panels by composition of two templates (for tab and panel respectively) and a data provider which feeds the templates with specific data.

The advantage of using TemplatedBarPanel instead of implementing the IBarPanel interface directly are:

  1. Implement just the TemplateDataProviderInterface and use your favourite templating engine for tab and panel templates.
  2. You abstract your implementation from a specific templating engine. Once you find a better/faster templating engine you can switch to it by just reimplementing the templates and not the way the data for them are gathered.
  3. You allow your panels to change their look without having to modify them. You just pass different templates to them.

Requirements

Installation

Install with composer

composer require slepic/templated-tracy-bar-panel

Usage

When implementing a IBarPanel for Tracy, instead of implementing the interface directly, create just a factory class, which will instantiate the TemplatedBarPanel like this:

class Factory
{
  /**
   * @param ...$dependencies Dependencies specific to your panel.
   * @return IBarPanel
   */
  public function create(...$dependencies)
  {
    return new TemplatedBarPanel(
      new MyTemplateDataProvider(...$dependencies),
      new OutputBufferTemplate(__DIR__ . '/tab.phtml'),
      new OutputBufferTemplate(__DIR__ . '/panel.phtml')
    );
  }
}

You need to implement the TemplateDataProviderInterface to provide specific data for your templates.

The two templates can be the OutputBufferTemplate provided by the slepic/php-template package.

But if you prefer a higher level template engine, see slepic/php-template-implementation to see if there is an existing binding for your favourite templating engine.

Changelog

0.2.0

  • Update dependency slepic/php-template to v0.2.
  • Changed return type of TemplateDataProviderInterface::getTabData() and TemplateDataProviderInterface::getPanelData() to array.
  • Changed travis setup to only run tests in oldest and newest php versions supported by this package (that is 5.6 and 7.3).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-04-28