承接 dantleech/symfony-form-array-to-delimited-string-transformer 相关项目开发

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

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

dantleech/symfony-form-array-to-delimited-string-transformer

Composer 安装命令:

composer require dantleech/symfony-form-array-to-delimited-string-transformer

包简介

Data transformer for SF form. Transforms delimited to string to array and vice-versa

README 文档

README

Build Status

This is a data transformer for the Symfony form framework.

It is meant for transforming text fields containing delimited strings to arrays.

Usage

You can use the data transformer as follows:

$form->add(
    $builder->create('tags', 'text')->addModelTransformer(
        new ArrayToDelimitedStringTransformer()
    )
);

This will transform the tags text field as follows:

// Tranform
array('one', 'two', 'three', 'four') === 'one, two, three, four'

// Reverse transform
'   one ,  two    , three, four,' === array('one', 'two', 'three', 'four')

Changing the delimiter

You can change the delimiting string with the first constructor argument:

new ArrayToDelimitedStringTransformer(';')

Will result in:

// Transform
array('one', 'two', 'three', 'four') === 'one; two; three; four'

// Reverse Transform
'one   ; two;three ;     four' => array('one', 'two', 'three')

Output padding

Additionally you can change the way in which the output is formatted with by setting the amount of whitespace (padding) before and after the text elements produced by a transformation:

new ArrayToDelimitedStringTransformer('%', 1, 1)

Will result in:

// Transform
array('one', 'two', 'three', 'four') === 'one % two % three % four'

// Reverse Transform
'one   % two%three %     four' => array('one', 'two', 'three')

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固