maikuolan/common
Composer 安装命令:
composer require maikuolan/common
包简介
Common classes package. Contains some common classes written for CIDRAM, phpMussel, etc, available for additional use elsewhere via this package.
README 文档
README
Common Classes Package.
The common classes package is intended to provide some of the classes that I originally wrote for common use by CIDRAM, phpMussel, etc as a separate, redistributable package, available to be readily integrated and used with other projects and packages via Composer.
All classes in the common classes package use the namespace Maikuolan\Common.
The common classes package currently contains the following classes:
- Cache: A simple, unified cache handler used by the CIDRAM and phpMussel projects for their caching needs. Currently, it supports APCu, Memcached, Redis, PDO, and flatfile caching.
- CommonAbstract: Common abstract for the common classes package. Not to be instantiated directly; To be extended by the other classes.
- ComplexStringHandler: The complex string handler class provides an easy way to iterate over the parts of a given string, identified by a given pattern, in order to execute a given closure to those parts of the given string, or to the glue that separates those parts.
- Context: Context attribute class (used internally by a few classes in the package). Not to be instantiated directly.
- DelayedIO: Provides an easy, simple solution for when needing to read and update a number of files, but delay rewriting the files for a while.
- Demojibakefier: Intended to normalise the character encoding of a given string to a preferred character encoding when the given string's byte sequences don't match the expectations of the preferred character encoding. Useful in cases where a block of data might conceivably be composed of several different unspecified, unknown encodings.
- Events: Allows the orchestration of "events" throughout a codebase by providing some simple methods to assign handlers to a particular event and to subsequently invoke those handlers at a later point in the codebase where the "event" is to occur.
- IPHeader: Attempts to resolve an originating IP address from a preferred source, or
REMOTE_ADDRif the preferred source isn't available. - L10N: Used by the CIDRAM and phpMussel projects to handle L10N data, the L10N handler reads in an array of L10N strings and provides some safe and simple methods for manipulating and returning those strings when needed, and for handling cardinal plurals, where integers and fractions are concerned alike, based upon the pluralisation rules specified by the L10N from a range of various pluralisation rules available, to be able to suit the needs of most known languages.
- LazyArray: For cases where it might be necessary to process some data in some way to generate an array, where that array mightn't always be needed for every request, but where the process to generate it must always be defined at some specific point in the code which is to be always executed, LazyArray provides a means by which the process can be defined while deferring its actual execution until either the array is actually accessed where needed (i.e., the object is treated as an array) or the execution is triggered manually, which could potentially improve performance at the implementation in some cases by reducing unnecessary processing.
- Matrix: Facilitates the generation of multidimensional arrays to an arbitrarily specified depth and number of elements, and facilitates iteration through those multidimensional arrays in any direction (whether up and down a particular array, across different depths, etc) via arbitrary callables and closures.
- NumberFormatter: Used by the CIDRAM and phpMussel projects to format numbers generated by their front-end pages, the class provides a more controllable, customisable mechanism for number formatting than PHP's internal
number_format()function. - Operation: Used by the CIDRAM and phpMussel projects for various operations related to dependency management (an integral part of the internal updates system).
- Request: Used by the CIDRAM and phpMussel projects to send outbound requests through cURL.
- YAML: Used by the CIDRAM and phpMussel projects to handle YAML data.
How to install:
The recommended way to install it is by using Composer:
composer require maikuolan/common
You can, however, download the classes you need from this repository manually, if you want to do so.
After you've downloaded the package, or any needed classes, PSR-4 autoloading is preferred way to access the classes (particularly if you're using a large number of different, unrelated classes). If you're installing the package via Composer, all you have to do is require_once 'vendor/autoload.php'; and everything will be taken care of. Alternatively, if you're installing the package or its classes manually (or without Composer), or if you don't want to use a PSR-4 autoloader, you can simply require or include any needed classes into your projects by using an include or require statement in your code, to point to the needed classes in any PHP code that needs them.
Other information:
Licensing:
Provided using the GNU General Public License version 2.0 (GPLv2).
For support:
Please use the issues page of this repository.
For contributors:
[CONTRIBUTING.md] Want to help?
Last Updated: 27 April 2026 (2026.04.27).
maikuolan/common 适用场景与选型建议
maikuolan/common 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 200.91k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2019 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yaml」 「php」 「l10n」 「classes」 「common」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 maikuolan/common 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maikuolan/common 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 maikuolan/common 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use internationalization functions for Laravel
Symfony2 Bundle Moment.js - Parse, validate, manipulate, and display dates in JavaScript
SUML for PHP
SUML support for Symfony
provides an facade for php-yaml, syck and symphony/yaml so switching in between is easier
Especificação do formato Cnab240 e Cnab400 traduzida para Yaml
统计信息
- 总下载量: 200.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 36
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2019-02-28