showapp/tld-support

TLDDatabase 和 TLDExtract 支持包

dev-master 2023-02-17 11:20 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:37:02 UTC


README

支持 TLDDatabaseTLDExtract 的包。此包提供处理数组、IP 地址、字符串等辅助工具。

Build Status Code Climate Test Coverage PHP 7 ready

此包符合 PSR-1PSR-2PSR-4 标准。如果发现不符合之处,请通过 pull request 提交补丁。

要求

以下版本的 PHP 受支持。

  • PHP 5.5
  • PHP 5.6
  • PHP 7.0
  • HHVM

用法

数组

mixed Arr::first(array $haystack, null|callable $callback, mixed $default);
mixed Arr::last(array $haystack, null|callable $callback, mixed $default);

IP 地址

bool IP::isValid(string $hostname);

字符串

bool     Str::endsWith(string $haystack, string|array $needles);
int      Str::length(string $value);
string   Str::lower(string $value);
string   Str::substr(string $string, int $start, int|null $length = null);
bool     Str::startsWith(string $haystack, string|array $needles);
bool|int Str::strpos(string $haystack, string $needles, int $offset = 0);
bool|int Str::strrpos(string $haystack, string $needles, int $offset = 0);

混合

mixed Mixed::value(mixed $value);

安装

通过 Composer

$ composer require layershifter/tld-support

测试

$ composer test

贡献

请参阅 CONTRIBUTINGCONDUCT 了解详细信息。

许可

此库根据 Apache 2.0 许可证发布。请参阅 许可文件 了解更多信息。