PHP code example of mothership-ec / cog-mothership-cp
1. Go to this page and download the library: Download mothership-ec/cog-mothership-cp 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/ */
mothership-ec / cog-mothership-cp example snippets
class MyDataset extends AbstractDataset
{
public function getName()
{
return 'my.dataset';
}
public function getPeriodLength()
{
return static::DAILY;
}
public function rebuild()
{
// add rebuilding sql to transaction and commit if not overridden
}
}
// From the beginning of time
$values = $dataset->range->getValues(0);
// From a week ago
$values = $dataset->range->getValues(
$dataset->range->getWeekAgo()
);
// Previous month
$values = $dataset->range->getValues(
$dataset->range->getMonthAgo(1),
$dataset->range->getMonthAgo()
);