idevlab/helpers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

idevlab/helpers

最新稳定版本:1.0.2

Composer 安装命令:

composer require idevlab/helpers

包简介

Helpers for the idevlab project

README 文档

README

Auteur Release Codacy grade License Téléchargement

Many PHP functions used in my projects, that you can use in your developments.

Authors

@fsinama

Installation

Install in your project with composer.

  composer require Idevlab/Helpers

Methods

ArrayHelper

::merge(array...$arrays): array

Merge array

/** @var array $foo */
$foo = ['one' => 1, 'three' => 3];

/** @var array $bar */
$bar = ['two' => 2];

$foo = ArrayHelper::merge($foo, $bar); // ['one' => 1, 'three' => 3, 'two' => 2]}

StringHelper

::toSnakeCase(string $string): string

Format a string in snake_case.

/** @var string $foo */
$foo = 'Test_DeChaine';

$foo = StringHelper::toSnakeCase($foo); // test_de_chaine

::toPascalCase(string $string): string

Format a string in PascalCase.

/** @var string $foo */
$foo = 'Test_DeChaine';

$foo = StringHelper::toPascalCase($foo); // TestDeChaine

::toSkewerCase(string $string): string

Format a string in skewer-case.

/** @var string $foo */
$foo = 'Test_DeChaine';

$foo = StringHelper::toSkewerCase($foo); // test-de-chaine

::toNoCase(string $string): string

Format a string in no case.

/** @var string $foo */
$foo = 'Test_DeChaine';

$foo = StringHelper::toNoCase($foo); // test de chaine

::toCase(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 = StringHelper::toCase($foo,1); // test de chaine

JsonHelper

::jsonSerialize(object $object, string ...$excludes): array

Serialize a object you.


class Foo {
    public string $bar = 'purple';
    public string $other = 'exclude value';
}

$foo = new Foo();

$foo = JsonHelper::jsonSerialize($foo,['other']); // { 'bar' => 'purple' }

DateHelper

::randomDateForRange(DateTime $start, ?DateTime $end = new DateTime('now')): DateTime

Find a random date between $start and $end

License

GPL3 or later

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-10-30