承接 php-filter/string 相关项目开发

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

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

php-filter/string

Composer 安装命令:

composer require php-filter/string

包简介

Take advantage of the ability to filter thongs with a filter chain.

README 文档

README

Minimum PHP Version Tests Latest Version GitHub

PHP String Filter is a library to perform character string transformation using a chain. You can use the most popular filters built into PHP and additional ones added by the author and community.

Support the following input data types: string, integer, float, boolean, null and object (must have a __toString method) Support the following output data types: string, int, float, bool and stringOrNull, intOrNull, floatOrNull

Installation

Install in your projects:

composer require php-filter/string

And use:

$filter = Filter::of('/_big_ball_of_mud_/')
            ->replace('/', '')
            ->replace('_', '')
            ->upperWords();

$filter->valueString(); // 'Big Ball Of Mud'

Filter list:

Filter Input Output
alnum() LLeMs!ZaF_F3dEX 4 LLeMsZaFF3dEX4
alnumWith('_') LLeMs!$%ZaF_F3dEX 4 LLeMsZaF_F3dEX4
append('Smith') John JohnSmith
camelize() primary-getallgroups-sys primaryGetallgroupsSys
extractBetween('<div>', '</div>') <div>test</div> test
htmlSpecialCharsDecode() &lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt; <a href="test">Test</a>
htmlSpecialChars() <a href="test">Test</a> &lt;a href=&quot;test&quot;&gt;Test&lt;/a&gt;
letter() girl_123 girl
letterWith('_') girl_123! girl_
limit(4) this is this
lowerFirst() Big Ben big Ben
lower() Lucy Brown lucy brown
numeric() a123 123
numericWith('.') 10.31 zl 10.31
prepend('John ') Smith JohnSmith
removeMultipleSpaces() Replacing multiple spaces Replacing multiple spaces
remove(' Up Front') Big Design Up Front Big Design
repeat(3) test testtesttest
replaceRegex('/[^a-zA-Z0-9]/', '') Big-Design-Up-Front BigDesignUpFront
replace('Design Up Front', 'Ball Of Mud') Big Design Up Front Big Ball Of Mud
reverse() test tset
shuffle() test tset
stripHtml('<b>') <u><b>test</b></u> dsadsa
strPadLeft(12, '0'); 2/10/2020 0002/10/2020
strPadRight(12, '0'); 0002/10/2 0002/10/2000
substr(0, 4); test 123 test
trimLeft('.') .test test
trimRight('.') test. test
trim() test test
upperFirst() lucy Lucy
upper() lucy Brown LUCY BROWN
upperWords() lucy lue Lucy Lue
wordWrap(3, '</br>') Big Design Up Front Big</br>Design</br>Up</br>Front

Filter example:

For a list of filters and more examples of their application, see unit tests.

$filter = Filter::of('/_big_ball_of_mud_/')
            ->replace('/', '')
            ->replace('_', '')
            ->upperWords();

$filter->valueString(); // 'Big Ball Of Mud'

An example of a reusable filter grouping:

$groupFilters = function ($value) {
	return Filter::of($value)->trim()->upperFirst()->append('.');
};

$filter = $groupFilters(' wikipedia is a free online encyclopedia');

$filter->valueString(); // 'Wikipedia is a free online encyclopedia.'

Example value output:

$filter = Filter::of(10.00)->value()->int() // 10
$filter = Filter::of(10.00)->value()->string() // '10.00'
$filter = Filter::of(true)->value()->string() // 'true'
$filter = Filter::of(null)->value()->intOrNull() // null

Example of value information:

$info = Filter::of('wikipedia is a free online encyclopedia, created and edited by by volunteers')->info();

$info->length(); // 76
$info->wordsCount(); // 12
$info->phaseCount('ee'); // 2

Roadmap

  • Description of all filters with examples
  • Add more filters
  • You tell me...

License

PHP String Filters is released under the MIT License. See the bundled LICENSE file for details.

Author

@Miłosz Karolczyk

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固