waynestate/parse-promos 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Latest Stable Version Build Status Total Downloads License

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

统计信息

  • 总下载量: 37.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固