waynestate/parse-promos
Composer 安装命令:
composer require waynestate/parse-promos
包简介
Parse promotion arrays from the Wayne State University API
README 文档
README
Parse promotion arrays from the Wayne State University API
Installation
To install this library, run the command below and you will get the latest version
composer require waynestate/parse-promos
Usage
Create the object
use Waynestate\Promotions\ParsePromos; ... $parsePromos = new Waynestate\Promotions\ParsePromos();
Make an API call for promotions
// Promotion groups to pull ( id => short_name ) $group_reference = [ 123 => 'circle', 124 => 'alumni-links', 125 => 'contact', 126 => 'progress-amount', 127 => 'progress-text', ]; // How to parse each group after the return ( short_name => config_option ) $group_config = [ 'contact' => 'first', 'progress-amount' => 'limit:1', 'progress-text' => 'randomize|first', ]; // Pull all the active items from the API $params = [ 'promo_group_id' => array_keys($group_reference), 'is_active' => '1', 'ttl' => TTL, ]; // Get the raw promotions from the API $raw_promos = $api->sendRequest('cms.promotions.listing', $params); // Parse the promotions based on the config set $parsed_promos = $parsePromos->parse($raw_promos, $group_reference, $group_config);
Config options
'first' = Return only the first item in the list (not part of an array)
'randomize' = Take the returned list and mix it up
'limit:#' = Return just # number of results from the list
'order:start_date_desc' = Return an ordered list by 'start_date' DESC
'order:start_date_asc' = Return an ordered list by 'start_date' ASC
'order:display_date_desc' = Return an ordered list by 'display_date' DESC
'order:display_date_asc' = Return an ordered list by 'display_date' ASC
'order:title_desc' = Return an ordered list by 'title' DESC
'order:title_asc' = Return an ordered list by 'title' ASC
'page_id:#' = Return only promotions in the list marked for this page
'youtube' = Parse the 'link' field for YouTube video ID, place in a new 'video_id' field
'order:start_date_desc|first' = Options can be run in combination by piping to another config
Tests
phpunit
Code Coverage
phpunit --coverage-html ./coverage
waynestate/parse-promos 适用场景与选型建议
waynestate/parse-promos 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.41k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「array」 「parse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 waynestate/parse-promos 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 waynestate/parse-promos 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 waynestate/parse-promos 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
yii2 xml request parser
Parse use statements for a reflection object
Trait providing methods to set class properties with an array.
Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Traits to build collections of specific objects
统计信息
- 总下载量: 37.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-09-06