oscarotero/view-helpers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

oscarotero/view-helpers

Composer 安装命令:

composer require oscarotero/view-helpers

包简介

Collection of useful functions to use in your templates.

README 文档

README

Collection of useful functions to use in your templates.

Text

Collection of helpers for text manipulation:

join

$pieces = ['one', 'two', 'three'];

echo ViewHelpers\Text::join($pieces); // "one, two and three"
echo ViewHelpers\Text::join($pieces, ' | '); // "one | two and three"
echo ViewHelpers\Text::join($pieces, ', ', ' & '); // "one, two & three"

Html

Functions to generate html

element

$element = ViewHelpers\Html::element('div', [
    'id' => 'my-id',
    'class' => ['class1, class2'],
    'style' => [
        'font-size' => '2em',
        'color' => 'blue'
    ],
    'hidden' => true
]);

echo $element; // <div id="my-id" class="class1 class2" style="font-size: 2em; color: blue" hidden>

picture

$element = ViewHelpers\Html::picture(
    [
        'default.jpg',
        '(min-width: 2000px)' => 'image_2000.jpg',
        '(min-width: 1000px)' => 'image_1000.jpg',
        '(min-width: 500px)' => 'image_500.jpg',
    ],
    'Alt text'
);

echo $element;
/*
<picture>
    <source srcset="image_2000.jpg 1x, image_4000.jpg 2x" media="(min-width: 2000px)">
    <source srcset="image_1000.jpg" media="(min-width: 1000px)">
    <source srcset="image_500.jpg" media="(min-width: 500px)">
    <img src="default.jpg" alt="Alt text">
</picture>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-24