承接 mattdanger/volt-helpers 相关项目开发

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

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

mattdanger/volt-helpers

最新稳定版本:v1.0

Composer 安装命令:

composer require mattdanger/volt-helpers

包简介

Useful additions to the Volt template engine

README 文档

README

Useful additions to the Volt template engine

Installing

Install using Composer:

{
	"require": {
		"mattdanger/volt-helpers": "dev-master"
	}
}

You'll also need to add each function to the Volt service:

$di->set('view', function () use ($config) {

  $view = new View();
  // ...
  $view->registerEngines(array(
    '.volt' => function ($view, $di) use ($config) {

      $volt = new VoltEngine($view, $di);

      $volt->getCompiler()->addFunction('ordinal', function ($resolvedArgs, $expArgs) {
        return 'VoltHelpers\Helpers::ordinal(' . $resolvedArgs . ')';
      });
      $volt->getCompiler()->addFunction('strToCurrency', function ($resolvedArgs, $expArgs) {
        return 'VoltHelpers\Helpers::strToCurrency(' . $resolvedArgs . ')';
      });
      $volt->getCompiler()->addFunction('pluralize', function ($resolvedArgs, $expArgs) {
        return 'VoltHelpers\Helpers::pluralize(' . $resolvedArgs . ')';
      });
      $volt->getCompiler()->addFunction('paginationPath', function ($resolvedArgs, $expArgs) {
        return 'VoltHelpers\Helpers::paginationPath(' . $resolvedArgs . ')';
      });
      // ... 

      return $volt;
    },
    // ...
  ));

  return $view;

});

Using Helpers

Here's a list of what's included:

ordinal($number)

Number ordinal service - returns 1st, 2nd, 10th, 43rd, 724th, etc.

strToCurrency($value)

Output a string in currency format

pluralize($count, $singular, $plural)

Pluralize string

paginationPath()

Returns a URL encoded string with current request params plus a param for current pagination page number.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-02