jmf/twig-array
最新稳定版本:1.0.0
Composer 安装命令:
composer require jmf/twig-array
包简介
Twig extension for interacting with arrays in Twig templates.
README 文档
README
Installation & Requirements
Install with Composer:
composer require jmf/twig-array
Usage in Twig templates
array_set()
Sets a specific key in an array.
{% set values = {} %}
{% set values = values|array_set('foo', 'bar') %}
array_unset()
Unsets a specific key in an array.
{% set values = {'foo': 'bar'} %}
{% set values = values|array_unset('foo') %}
array_push()
Appends a new value at the end of an array.
{% set values = {'foo'} %}
{% set values = values|array_push('bar') %}
array_pop()
Removes the last item of an array.
{% set values = {'foo', 'bar'} %}
{% set values = values|array_pop() %}
array_unshift()
Appends a new value at the beginning of an array.
{% set values = {'foo'} %}
{% set values = values|array_unshift('bar') %}
array_shift()
Removes the first item of an array.
{% set values = {'foo', 'bar'} %}
{% set values = values|array_shift() %}
统计信息
- 总下载量: 243
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2024-06-05