intervention/helper
最新稳定版本:1.1.4
Composer 安装命令:
composer require intervention/helper
包简介
Easier handling and formating of strings and dates
README 文档
README
This package is abandoned and will no longer be maintained. I suggest using Carbon for much more advanced date functionality and the helper functions of Illuminate/Support to format text.
Intervention Helper Class (Abandoned)
Easier handling and formating of strings and dates. Made to work with Laravel 4 but runs also standalone.
Installation
You can install the Helper classes quick and easy with Composer.
Require the package via Composer in your composer.json.
"intervention/helper": "dev-master"
Run Composer to update the new requirement.
$ composer update
The Helper classes are built to work with the Laravel 4 Framework. The integration is done in seconds.
Open your Laravel config file config/app.php and add the following lines.
In the $providers array add the service providers for this package.
'providers' => array(
...
'Intervention\Helper\DateServiceProvider',
'Intervention\Helper\StringServiceProvider'
),
Add the facade of this package to the $aliases array.
'aliases' => array(
...
'Date' => 'Intervention\Helper\Facades\Date',
'String' => 'Intervention\Helper\Facades\String'
),
Usage
Date Helper
- Date::__construct - Returns new Date Helper object
- Date::format - Formats given timestamp to a readable format (available formats are 'date', 'datetime', 'digitdate', 'iso')
- Date::age - Calculates age between timestamps and returns readable format
Code Example (Laravel)
// returns '24. Oktober 2003, 10:45' in german locale return Date::format('datetime', '2003-10-24 10:45:13'); // returns 'October 24, 2003, 10:45 AM' in english locale return Date::format('datetime', '2003-10-24 10:45:13'); // returns '10 Jahre' in german locale return Date::age('2003-10-24 10:00', '2013-10-24 10:45:13'); // methods also takes unix timestamps of DateTime objects, second parameter is optional return Date::age(1292177455);
String Helper
- String::__construct - Returns new String Helper object
- String::pluralize - Returns singular or plural based on the given count
- String::alternator - Returns given parameters by turns
- String::formatMoney - Format amount of money based on locale
- String::formatFilesize - Format filesize in bytes to a more readable version
- String::random - Returns random string in wanted format
- String::shorten - Shortens text to length and keeps integrity of words
- String::slug - Format given string to url-friendly format
Code Example (Laravel)
// returns '4 cars' return String::pluralize(4, 'car', 'cars'); // returns '1.200,00 EUR' in german locale return String::formatMoney(1200, 'EUR'); // echoes different values repeated one after another for ($i=0; $i < 10; $i++) { echo String::alternator('one', 'two', 'three'); } // you may also use arrays as input for alternator for ($i=0; $i < 10; $i++) { echo String::alternator(array('one', 'two', 'three')); }
License
Intervention Helper Class is licensed under the MIT License.
intervention/helper 适用场景与选型建议
intervention/helper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.66k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2013 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「date」 「string」 「helper」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 intervention/helper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 intervention/helper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 intervention/helper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Tools to convert between .NET and PHP date formats
Encode integer IDs using a preset or customized symbol set
Datetime helpers for timezone handling
base62 encoder and decoder also for big numbers with Laravel integration
PHP string processing library.
统计信息
- 总下载量: 4.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-01-19