1. Go to this page and download the library: Download waynestate/parse-promos library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
waynestate / parse-promos example snippets
use Waynestate\Promotions\ParsePromos;
...
$parsePromos = new Waynestate\Promotions\ParsePromos();
// 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);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.