承接 brbunny/brplates 相关项目开发

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

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

brbunny/brplates

Composer 安装命令:

composer require brbunny/brplates

包简介

BrPlates is a component for handling view layer using Plates

README 文档

README

Maintainer PHP from Packagist Latest Version Software License Total Downloads

BrPlates is a component for handling view layer using Plates

Installation

BrPlates is available through Composer:

"brbunny/brplates": "1.2.*"

or run

composer require brbunny/brplates

Documentation

For more details on how to use BrPlates, see the example folder with details in the component directory or to learn more visit PlatesPHP

Initialization

To start using BrPlates, instantiate the class inside your controller. To learn more, visit PlatesPHP

Para começar a usar o BrPlates, instancie a classe dentro do seu controlador. Para saber mais, visite PlatesPHP

<?php

use BrBunny\BrPlates\BrPlates;

class Controller
{
    /** @var BrPlates; */
    private $view;

    public function __construct($path, $ext)
    {
        // $this->view = new BrPlates($path, $ext);
        $this->view = new BrPlates($path); //Extension is optional
    }
}
function

Create a unique function for a specific use.

Criar uma função única para um caso específico.

<?php

// Register a one-off function
$this->view->function("name", function ($params) {
    // Type Code
});
path and removePath

Group your models in different namespaces.

Agrupe seus modelos em diferentes namespaces.

<?php

// Get template from another directory
$this->view->path("profile", "./theme/profile");

//Use template
$this->view->show("profile::profile", ["user" => "Jow User"]);

// Remove template added
$this->view->removePath("profile");
data

If you have data in common across multiple models, use the data() function.

Se possuir dados em comum em vários modelos utilize a função data().

<?php
//
$this->view->data(['company' => 'BrPlates'], ["_theme", "home"]);
$this->view->data(['company' => 'BrPlates']); // Template is Optional
render

If you want to store the model in a variable, use the render() function. If you want to render the model directly, use the show() function.

Se deseja armazenar o modelo em uma variável, utilize a função render(). Já se quiser renderizar o modelo direto utilize a função show().

<?php
$template = $view->render("_theme", ["user" => "Jow User"]);
echo $template;

$this->view->show("_theme", ["user" => "Jow User"]);
isset

To check if a model exists, simply use the isset() function.

Para verificar se um modelo existe, basta utilizar a função isset()

<?php

if ($this->view->isset("_theme")) {
   // Exist
}
widget

If you want to create a tree of components, use the widget()

Se você deseja criar uma árvore de componentes, utilize widget()

/*
Content of the widgets::list template:

<ul>
    <?= $this->section('widgets') ?>
</ul>
*/
<?= $this->widget("widgets::list", [/* Items */])  ?>

// Example
<?= $this->widget("widgets::list", [
    $this->child("widgets::item", ["content" => "Text"]),
    $this->child("widgets::item", ["content" => "Text2"]),
    $this->children("widgets::list2", [
        $this->child("widgets::item", ["content" => "Text3.1"]),
    ], ["label" => "Text3"])
])  ?>
children

If you have a component that has child components, and that same component contains data, use children()

Se existe um componente que possui componentes filhos, e esse mesmo componente contem data utilize children()

/*
Content of the widgets::children template:

<li>
    <?= $label ?>
    <ul>
        <?= $this->section('widgets') ?>
    </ul>
</li>
*/
$this->children("widgets::list2", [
        $this->child("widgets::item", ["content" => "Text1.1"]),
], ["label" => "Text1"]);
child

If the component doesn't have any children, use child()

Se o componente não tiver filhos, utilize child()

/*
Content of the widgets::item template:

<li><?= $content ?></li>
*/
$this->child("widgets::item", ["content" => "Text"]);
renderMinify

Reduce code to render.

Reduzir código para renderização.

<?php

echo $view->renderMinify("profile::profile", ["user" => "Jow User"]);

OBS: To minify js scripts, put "js-mix" in the opening of the script tag

OBS: Para minimizar scripts js, coloque "js-mix" na abertura da tag script

<script js-mix>
    // Alert
    alert('minify');
</script>

// Result
<script>alert('minify');</script>

Credits

License

The MIT License (MIT). Please see License File for more information.

brbunny/brplates 适用场景与选型建议

brbunny/brplates 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 127 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 02 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 brbunny/brplates 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 brbunny/brplates 我们能提供哪些服务?
定制开发 / 二次开发

基于 brbunny/brplates 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-06