定制 mahounou/uconv 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mahounou/uconv

Composer 安装命令:

composer require mahounou/uconv

包简介

Lightweight unit converter library

README 文档

README

Lightweight PHP unit converter (PSR-4).

Installation

Via Composer (recommandé)

composer require uconv/uconv

Ou depuis le dépôt (pour développement)

composer install

Usage

<?php
require 'vendor/autoload.php';

use Uconv\Uconv;

echo Uconv::convert("10km", "m");      // 10000
echo Uconv::convert("5lbs", "kg");     // 2.26796
echo Uconv::convert("1hr", "min");     // 60
echo Uconv::convert("100USD", "EUR");  // ~85

Text counter

use Uconv\Counter;

Counter::increment("server.request");      // 1
Counter::increment("server.request");      // 2
Counter::increment("loop.iteration");      // 1

echo Counter::get("server.request");       // 2
print_r(Counter::all());                   // ["server.request" => 2, "loop.iteration" => 1]

The counter only counts text and returns numbers. You can use the returned value with a file, a JSON document, a database, logs, or any other storage you choose. By default, counts are kept in memory for the current PHP process.

Uconv::convert() also increments the internal uconv.requests counter:

Uconv::resetRequestCount();
Uconv::convert("10km", "m");

echo Uconv::getRequestCount();             // 1

Testing

./vendor/bin/phpunit tests/

Features

  • PSR-4 namespaces
  • Static API Uconv::convert()
  • Custom exceptions
  • Exact Node.js/Python parity

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固