dexen/mulib

微工具。UUID 生成器、调试、LZ4 解压缩。

0.0.8 2020-03-03 15:41 UTC

This package is auto-updated.

Last update: 2024-09-07 18:06:06 UTC


README

PHP 的快速 UUID v4 生成器:0.7 秒内 1MM。

纯 PHP 的 LZ4 解压缩器,约 30MB/s。为了简化,校验和未进行验证。

兼容 ComposerPSR-4

安装

composer require dexen/mulib

使用

基本使用

$uuid_v4 = \dexen\mulib\Uuid::generateUuidV4();
$uuid_v5 = \dexen\mulib\Uuid::generateUuidV5($namespace_uuid, $name);
$decompressed = \dexen\mulib\Lz4::decompress(file_get_contents('my-data.lz4'));

提供 shell 使用 lz4cat 替代品

lz4cat-php < my-data.lz4 > my-data

考虑定义一个辅助函数

function generate_uuid_v4() : string
{
	return \dexen\mulib\Uuid::generateUuidV4();
}