layershifter/tld-support

该包已被放弃,不再维护。没有推荐替代包。

TLDDatabase 和 TLDExtract 的支持包

1.1.1 2016-06-18 12:28 UTC

This package is auto-updated.

Last update: 2020-01-23 22:49:06 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 许可证下发布。有关更多信息,请参阅 许可证文件