idevlab/essential
最新稳定版本:1.8.0
Composer 安装命令:
composer require idevlab/essential
包简介
All the methods and tools useful for the development of the various idevlab projects.
README 文档
README
Many PHP functions used in my projects, that you can use in your developments.
Authors
Installation
Install in your project with composer.
composer require idevlab/essential
Methods
Array
i_array_merge(array...$arrays): array
Merge array
/** @var array $foo */
$foo = ['one' => 1, 'three' => 3];
/** @var array $bar */
$bar = ['two' => 2];
$foo = i_array_merge($foo, $bar); // ['one' => 1, 'three' => 3, 'two' => 2]}
String
str_to_snake_case(string $string): string
Format a string in snake_case.
/** @var string $foo */
$foo = 'Test_DeChaine';
$foo = str_to_snake_case($foo); // test_de_chaine
str_to_pascal_case(string $string): string
Format a string in PascalCase.
/** @var string $foo */
$foo = 'Test_DeChaine';
$foo = str_to_pascal_case($foo); // TestDeChaine
str_to_skewer_case(string $string): string
Format a string in skewer-case.
/** @var string $foo */
$foo = 'Test_DeChaine';
$foo = str_to_skewer_case($foo); // test-de-chaine
str_to_no_case(string $string): string
Format a string in no case.
/** @var string $foo */
$foo = 'Test_DeChaine';
$foo = str_to_no_case($foo); // test de chaine
str_to_case(string $string): string
Format a string in no case.
/** @var string $foo */
$foo = 'Test_DeChaine';
// NO : 0
// PASCAL : 1
// CAMEL : 2
// SKEWER : 3
// SNAKE : 4
$foo = str_to_case($foo,1); // test de chaine
JSON
i_json_serialize(object $object, string ...$excludes): array
Serialize a object you.
class Foo {
public string $bar = 'purple';
public string $other = 'exclude value';
}
$foo = new Foo();
$foo = i_json_serialize($foo,['other']); // { 'bar' => 'purple' }
Date
i_random_date(DateTime $start, ?DateTime $end = new DateTime('now')): DateTime
Find a random date between $start and $end
License
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-10-11