定制 anekdotes/support 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

anekdotes/support

Composer 安装命令:

composer require anekdotes/support

包简介

Utility classes meant to facilitate object manipulation.

README 文档

README

Latest Stable Version Build Status License Total Downloads

Utility classes meant to facilitate object manipulation

Installation

Install via composer into your project:

composer require anekdotes/support

Usage

Use the class where ever you need it:

use Anekdotes\Support\Arr;

or

use Anekdotes\Support\Str;

or

use Anekdotes\Support\UUID;

or

use Anekdotes\Support\I18n;

Arr

Helper class which facilitates array manipulation.

Method sortByKey (*array, *string, enum)

Arr::sortByKey([['id' => 2],['id' => 1],['id' => 3]], 'id');
// [['id' => 1],['id' => 2],['id' => 3]]

Arr::sortByKey([['id' => 2],['id' => 1],['id' => 3]], 'id', SORT_DESC);
// [['id' => 3],['id' => 2],['id' => 1]]

Method get (*array, *string, string)

Arr::get(['id'=>1, 'title'=>'foo'], 'title');
// foo

//With default param if non is found
Arr::get(['id'=>1, 'title'=>'foo'], 'bar', 'toaster');
// toaster

Method getWhere (*array, *string, *string, string)

$dummy = [
    ['id' => 1, 'name' => 'Bell'],
    ['id' => 2, 'name' => 'Lani']
];
Arr::getWhere($dummy, 'name', 'Lani');
// ['id' => 2, 'name' => 'Lani']

Method exists (*string, *array)

Arr::exists('title', ['id'=>1, 'title'=>'foo']);
// true

Arr::exists('bar', ['id'=>1, 'title'=>'foo']);
// false

Method remove (*string, *array)

$dummy = ['id'=>1, 'title'=>'foo'];
Arr::remove('title', $dummy);
$dummy // ['id'=>1]

$dummy = ['id'=>1, 'title'=>'foo'];
Arr::remove('foo', $dummy);
$dummy // ['id'=>1, 'title'=>'foo']

Str

Contains helper functions used to manipulate strings.

Method startsWith (*string, *string)

Str::startsWith('foo', 'f');
// true

Method endsWith (*string, *string)

Str::endsWith('foo', 'o');
// true

Method split (*string, *string)

Str::split(',', '1,2,3,4,5');
// [1, 2, 3, 4, 5]

Method capitalize (*string)

Str::capitalize('foo');
// Foo

Method upper (*string)

Str::upper('foo');
// FOO

Method lower (*string)

Str::lower('FOO');
// foo

Method snakeCase (*string)

Str::snakeCase('étoile filante');
// etoile_filante

Method camelCase (*string)

Str::camelCase('foo bar');
// fooBar

Method contains (*string, *string)

Str::contains('foo', 'oo');
// true

Method studly (*string)

Str::studly('foo bar');
// FooBar

Method ascii (*string)

Str::ascii('étoile');
// etoile

Method slug (*string, string)

Str::slug('foo bar');
// foo-bar

Method random (*integer)

Str::random();
// random 16 characters string

Str::random(20);
// random 20 characters string

Method quickRandom (*integer)

Str::quickRandom();
// random quick 16 characters string

Str::quickRandom(20);
// random quick 20 characters string

Method replace (*string, *string, *string)

Str::replace('foo', 'oo', 'yy');
// fyy

Method regexResult ()

Str::regexResult('/([\w]+)/', 'foo bar', 0);
// ['foo', 'bar']

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固