timoreith/phpease
最新稳定版本:1.3.0
Composer 安装命令:
composer require timoreith/phpease
包简介
PHP Helpers
README 文档
README
Little PHP helpers with the purpose of easing and abstracting code for recurring tasks.
Installation
To install the package, use Composer:
composer require timoreith/phpease
Usage Examples
Here are some examples of how to use the classes and functions provided by this package:
ResultContainer
use PhPease\ResultContainer; $result = new ResultContainer(); $result->setSuccess(true) ->setMessage('Operation successful') ->setResult(['data' => 'value']); if ($result->isSuccess()) { $result = $result->getResult(); } else { echo $result->getMessage(); }
var_to_array
use function PhPease\Variable\var_to_array; // Example 1: Convert a string to an array $string = "apple, banana, cherry"; $array = var_to_array($string); print_r($array); // Output: ['apple', 'banana', 'cherry'] // Example 2: Convert a string to an array and apply a callback $string = "1, 2, 3"; $array = var_to_array($string, 'intval'); print_r($array); // Output: [1, 2, 3]
Running Tests
To run the tests, use PHPUnit:
./vendor/bin/phpunit
Contributing
Feel free to contribute by submitting issues or pull requests. Please follow the coding standards and write tests for new features.
License
This project is licensed under the MIT License. See the LICENSE file for details.
统计信息
- 总下载量: 557
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-04