Download the PHP package mofeier/tools without Composer
On this page you can find all versions of the php package mofeier/tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download mofeier/tools
More information about mofeier/tools
Files in mofeier/tools
Download mofeier/tools
More information about mofeier/tools
Files in mofeier/tools
Vendor mofeier
Package tools
Short Description A powerful PHP toolkit for common development tasks
License Apache License 2.0
Package tools
Short Description A powerful PHP toolkit for common development tasks
License Apache License 2.0
Please rate this library. Is it a good library?
Informations about the package tools
PHP通用工具包
一个简洁、高效、功能丰富的PHP通用工具包,为项目开发提供基础功能支持。
功能特点
- 统一的API返回格式管理(消息体)
- 状态码统一管理与自定义
- 字符串处理(多字节支持)
- 数组操作(树结构转换、深度合并等)
- 安全加密(支持OpenSSL和Sodium多种加密引擎)
- URL安全的加密解密功能
- JSON/XML格式转换
- 高精度数学计算工具
- 链式调用和静态调用支持
- 符合PSR标准的命名规范
- Facade模式支持
系统要求
- PHP 7.4+
- Mbstring扩展(多字节字符串处理)
- JSON扩展
- OpenSSL扩展(加密功能)
- Sodium扩展(可选,提供更安全的加密)
- BC Math扩展(高精度计算)
安装
使用示例
1. 消息体处理(Message类)
统一API返回格式,支持链式调用和静态调用。
基础使用
链式调用
扩展字段
字段映射(替换默认字段名)
格式转换
独立方法调用
2. 状态码管理(StatusCodes类)
统一管理系统状态码和对应消息提示。
3. 工具函数(Utils类)
提供各种实用工具方法,所有工具函数均以util_开头。
数组操作
字符串处理
编码解码
加密解密工具方法
许可证生成
安全工具
4. 安全加密(Security类)
提供多种加密方式,支持OpenSSL和Sodium引擎。
5. 高精度数学计算(Maths类)
提供高精度数学计算功能,适用于金融计算等场景。
6. Facade模式使用
Facade模式提供了更简洁的调用方式,类似于Laravel和ThinkPHP的Facade体验。
基础使用
链式调用与Facade
静态方法直接调用
架构设计
目录结构
命名规范
- 类名:采用帕斯卡命名法(PascalCase)
- 方法名:采用小驼峰命名法(camelCase)
- 常量:采用全大写+下划线(UPPER_CASE_WITH_UNDERSCORE)
- 私有属性:以下划线开头(_privateProperty)
- 工具函数:以
util_开头(如util_json_encode) - 字符串处理函数:以
str_开头(如str_length) - 数学计算函数:以
math_开头(如math_add)
错误处理
所有方法都包含适当的错误处理机制,对于关键操作会抛出异常,方便进行错误追踪和调试。
测试
运行测试:
贡献
欢迎提交Issue和Pull Request来帮助改进这个工具包。
许可证
本项目采用 Apache 2.0开源许可证。
All versions of tools with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4.0
The package mofeier/tools contains the following files
Loading the files please wait ...