simplepie/utility-pack
Composer 安装命令:
composer require simplepie/utility-pack
包简介
A set of small utilities for PHP.
关键字:
README 文档
README

Utility Pack
A set of small utilities for PHP 7.2+.
Badges
Health
Quality
Social
Compliance
Usage
QueryString
Believe it or not, different PHP installations can have different default values for generating query strings. This class uses explicit rules so that query strings are always generated exactly the same way. Leverages http_build_query() under the hood.
<?php use SimplePie\UtilityPack\Util\QueryString; echo QueryString::build([ 'limit' => 'a', 'order' => 'b', 'offset' => 'c', ]); #=> limit=a&order=b&offset=c
Time
Simple constants for time. Makes time calculations easier to read and understand.
<?php use SimplePie\UtilityPack\Util\Time; echo sprintf('%s, %s, %s', 1 * Time::SECOND, 2 * Time::SECONDS, 10 * Time::SECONDS); #=> 1, 2, 10 echo sprintf('%s, %s, %s', 1 * Time::MINUTE, 2 * Time::MINUTES, 10 * Time::MINUTES); #=> 60, 120, 600 echo sprintf('%s, %s, %s', 1 * Time::HOUR, 2 * Time::HOURS, 10 * Time::HOURS); #=> 3600, 7200, 36000 echo sprintf('%s, %s, %s', 1 * Time::DAY, 2 * Time::DAYS, 10 * Time::DAYS); #=> 86400, 172800, 864000 echo sprintf('%s, %s, %s', 1 * Time::WEEK, 2 * Time::WEEKS, 10 * Time::WEEKS); #=> 604800, 1209600, 6048000 echo 0.5 * Time::YEAR; #=> 15778800
You can also use the standard ISO-8601 format, with second granularity, and set to UTC “Zulu” time (using the Z annotation).
<?php use SimplePie\UtilityPack\Util\Time; echo gmdate(Time::FORMAT_ISO8601_ZULU); #=> 2017-05-28T01:46:06Z
Type
You can easily get the scalar type or classname of any object.
<?php use SimplePie\UtilityPack\Util\Types; echo Types::getClassOrType( new \SimpleXMLElement('<xml/>') ); #=> SimpleXMLElement echo Types::getClassOrType( new DateTime( 'now', new DateTimeZone('UTC') ) ); #=> DateTime echo Types::getClassOrType('string')); #=> string echo Types::getClassOrType(111)); #=> integer echo Types::getClassOrType(111.0)); #=> double echo Types::getClassOrType(true)); #=> boolean echo Types::getClassOrType(false)); #=> boolean
Coding Standards
PSR-1/2/5/12/19 are a solid foundation, but are not an entire coding style by themselves. We automate a large part of our style requirements using PHP CS Fixer and PHP CodeSniffer. (The things that we cannot yet automate are documented in the SimplePie NG Coding Standards.)
These can be applied/fixed automatically by running the (lightweight) linter:
make lint
Additionally, in our quest to write excellent code, we use a variety of tools to help us catch issues with what we've written, including:
| Type | Description |
|---|---|
| Linting Tools | PHP CS Fixer, PHP CodeSniffer |
| QA Tools | PDepend, PHPLOC, PHP Copy/Paste Detector, PHP Code Analyzer |
| Static Analysis | Phan, PHPStan, Psalm, PHP Dependency Analysis |
These reports can be generated by running the (heavyweight) analyzer:
make analyze
Please Support or Sponsor Development
The SimplePie project is a labor of love. Development of the next-generation of SimplePie was started in June 2017 as because it's a project I love, and I believe our community would benefit from this tool.
If you use SimplePie — especially to make money — it would be swell if you could kick down a few bucks. As the project grows, and we start leveraging more services and architecture, it would be great if it didn't all need to come out of my pocket.
You can also sponsor the development of a particular feature. If there's a feature that you want to see implemented, and I believe it's the right fit for the SimplePie project, you can sponsor the development of the feature to get it prioritized.
Your contributions are greatly and sincerely appreciated. See the Sponsor button along the top of the page for more information.
simplepie/utility-pack 适用场景与选型建议
simplepie/utility-pack 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 216 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「url」 「time」 「types」 「querystring」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simplepie/utility-pack 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simplepie/utility-pack 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simplepie/utility-pack 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Tools to convert between .NET and PHP date formats
Adds the EDTF data type to Wikibase
Easy URL rewrites in your Laravel application
Date component is a set of methods to help with the manipulation of dates.
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Delayed Process For Laravel.
统计信息
- 总下载量: 216
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-05-06