PHP code example of r-a-f / ecommerce-realization-days
1. Go to this page and download the library: Download r-a-f/ecommerce-realization-days 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/ */
r-a-f / ecommerce-realization-days example snippets
use RealizationDays\RealizationDays;
$config = new RealizationDays();
$config->setGoldenHour(14);
$config->setRealizationDays(3);
$config->setDateDaysOff(['2025-05-01', '2025-05-03']);
$config->setDateWeekOff([6, 7]); // Saturday and Sunday
$context = $config->calc();
echo $context->date->format('Y-m-d');
use RealizationDays\RealizationDaysFormatter;
// Format output
$formatter = new RealizationDaysFormatter($context);
// Set weekdays and templates
$formatter->setTranslation(
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
[
'BEFORE_TODAY' => 'Order today – ships before %DATE_OR_WEEKDAY%',
'BEFORE_TOMORROW' => 'Order today – ships tomorrow!',
'BEFORE_NEXT_DAYS' => 'Order today – ships by %DATE_OR_WEEKDAY%',
'AFTER_TODAY' => 'Order now – ships until %GOLDEN_HOUR% today',
'AFTER_TOMORROW' => 'Order now – ships the day after tomorrow',
'AFTER_NEXT_DAYS' => 'Order now – ships by %DATE_OR_WEEKDAY%',
]
);
echo $formatter->format('d-m-Y'); // e.g. "Order today – ships by 20-04-2025"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.