florianwolters/component-core-comparable
Composer 安装命令:
composer require florianwolters/component-core-comparable
包简介
Imposes a total ordering on objects as a PHP component.
README 文档
README
FlorianWolters\Component\Core\Comparable is a simple-to-use PHP component that imposes a total ordering on objects.
Introduction
This component is inspired by the following three artifacts of the Java programming language.
- The interface
java.lang.Comparableof the Java Platform Standard Edition (SE). - The interface
java.util.Comparatorof the Java Platform SE. - The method
org.apache.commons.lang3.ObjectUtils.compareof the Apache Commons Lang API:
FlorianWolters\Component\Core\Comparable consists of two artifacts:
- The interface
FlorianWolters\Component\Core\ComparableInterface: Imposes a total ordering on the objects of each class that implements it. - The static class
FlorianWolters\Component\Core\ComparableUtils: Offers comparison operations that impose a total ordering on objects.
Features
-
The static method
FlorianWolters\Component\Core\ComparableUtils::compareisnull-safe. A client can determine ifnullis considered greater than a non-nullvalue or ifnullis considered less than a non-nullvalue. -
Artifacts tested with both static and dynamic test procedures:
- Dynamic component tests (unit tests) implemented using PHPUnit.
- Static code analysis performed using the following tools:
- PHP_CodeSniffer: Style Checker
- PHP Mess Detector (PHPMD): Code Analyzer
- phpcpd: Copy/Paste Detector (CPD)
- phpdcd: Dead Code Detector (DCD)
-
Installable via Composer or the PEAR command line installer:
-
Provides a Packagist package which can be installed using the dependency manager Composer.
-
Provides a PEAR package which can be installed using the package manager PEAR installer.
Click here for the PEAR channel.
-
-
Provides a complete Application Programming Interface (API) documentation generated with the documentation generator ApiGen.
Click here for the current API documentation.
-
Follows the PSR-0 requirements for autoloader interoperability.
-
Follows the PSR-1 basic coding style guide.
-
Follows the PSR-2 coding style guide.
-
Follows the Semantic Versioning Specification (SemVer) 2.0.0-rc.1.
Requirements
- PHP >= 5.4
Usage
The best documentation for FlorianWolters\Component\Core\Comparable are the unit tests, which are shipped in the package. You will find them installed into your PEAR repository, which on Linux systems is normally /usr/share/php/test.
Installation
Local Installation
FlorianWolters\Component\Core\Comparable should be installed using the dependency manager Composer. Composer can be installed with PHP.
php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"
This will just check a few PHP settings and then download
composer.pharto your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.Next, run the
installcommand to resolve and download dependencies:
php composer.phar install
System-Wide Installation
FlorianWolters\Component\Core\Comparable should be installed using the PEAR installer. This installer is the PHP community's de-facto standard for installing PHP components.
pear channel-discover pear.florianwolters.de
pear install --alldeps fw/Comparable
As A Dependency On Your Component
Composer
If you are creating a component that relies on FlorianWolters\Component\Core\Comparable, please make sure that you add FlorianWolters\Component\Core\Comparable to your component's composer.json file:
{
"require": {
"florianwolters/component-core-comparable": "0.2.*"
}
}
PEAR
If you are creating a component that relies on FlorianWolters\Component\Core\Comparable, please make sure that you add FlorianWolters\Component\Core\Comparable to your component's package.xml file:
<dependencies> <required> <package> <name>Comparable</name> <channel>pear.florianwolters.de</channel> <min>0.2.0</min> <max>0.2.99</max> </package> </required> </dependencies>
Development Environment
If you want to patch or enhance this component, you will need to create a suitable development environment. The easiest way to do that is to install phix4componentdev:
# phix4componentdev
pear channel-discover pear.phix-project.org
pear install phix/phix4componentdev
You can then clone the Git repository:
# PHP-Component-Core-Comparable
git clone http://github.com/FlorianWolters/PHP-Component-Core-Comparable
Then, install a local copy of this component's dependencies to complete the development environment:
# build vendor/ folder
phing build-vendor
To make life easier for you, common tasks (such as running unit tests, generating code review analytics, and creating the PEAR package) have been automated using phing. You'll find the automated steps inside the build.xml file that ships with the component.
Run the command phing in the component's top-level folder to see the full list of available automated tasks.
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://gnu.org/licenses/lgpl.txt.
florianwolters/component-core-comparable 适用场景与选型建议
florianwolters/component-core-comparable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 187 次下载、GitHub Stars 达 0, 最近一次更新时间为 2013 年 01 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「core」 「comparison」 「compareTo」 「comparable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 florianwolters/component-core-comparable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 florianwolters/component-core-comparable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 florianwolters/component-core-comparable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Interfaces and functions for type-safe, consistent value comparison
Contao Open Source CMS
A simple tool to check your i18n translation files to make sure they are complete across all languages
A PHP trait to enable bitwise comparison of flags
Submodule for SilverShop which allows you to compare products in a table.
DiZed Team Core module for the Magento 2 project
统计信息
- 总下载量: 187
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2013-01-07