承接 echron/tools 相关项目开发

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

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

echron/tools

最新稳定版本:1.8.1

Composer 安装命令:

composer require echron/tools

包简介

Tools library for PHP

README 文档

README

Unit Tests Latest Stable Version

About

Echron PHP Tool library offers a set of handy classes and methods to simplify PHP development.

Installation

Install the latest version with

composer require echron/tools

Usage

Output seconds as human-readable string

echo \Echron\Tools\Time::readableSeconds(60 * 24);
>> 24 minutes
echo \Echron\Tools\Time::readableSeconds(60 + 3.4221580028534);
>> 1 minute, 3.42 seconds
echo \Echron\Tools\Time::readableSeconds(3.455669555);
>> 3.46 seconds

Check if array has duplicates

$a = \Echron\Tools\ArrayHelper::hasDuplicates(['red', 'green', 'purple']);
print_r($a);
>> false

$b = \Echron\Tools\ArrayHelper::hasDuplicates(['red', 'green', 'purple','red]);
print_r($b);
>> true

Filter array by unique values

$a = \Echron\Tools\ArrayHelper::unique(['red', 'green', 'purple'],['orange','red']);
print_r($a);
>> ['red','green','purple','orange']

Limit a string without cutting of words

$a = \Echron\Tools\StringHelper::limitWords('This is a basic string', 20);
print_r($a);
>> "This is a basic"

It is possible to pass along an end marker that will be added to the endof the string when the string is truncated. The end marker is included in the maximum character string, the result will not be longer than the maximum characters even when the end marker is added.

$result = \Echron\Tools\StringHelper::limitWords('This is a basic string', 20, ' ...');
print_r($result);
>> "This is a basic ..."

Limit a string

$result = \Echron\Tools\StringHelper::limit('This is a basic string', 20);
print_r($result);
>> "This is a basic stri"

Add an end marker

$result = \Echron\Tools\StringHelper::limit('This is a basic string', 20, ' ...');
print_r($result);
>> "This is a basic  ...', $result)"

CSV

  • Read out CSV file into an array
$result = \Echron\Tools\CsvHelper::parseCSVFile('file.csv');
  • Write a CSV file based on an array
$result = \Echron\Tools\CsvHelper::toCSVFile(['field'=> 'value'], 'file.csv');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固