nacholibre/billingdates

Generates start and end date for a billing cycle.

1.0.4 2020-02-22 21:21 UTC

This package is auto-updated.

Last update: 2024-12-23 07:48:58 UTC


README

Generates start and end date for a billing cycle in PHP.

Installation

composer require nacholibre/billingdates

Example usage

<?php
use BillingDates\Calculator;

$calculator = new Calculator;

$startBillingDate = \DateTime::createFromFormat($defaultFormat, '2019-01-15');
$stubCurrentDate = \DateTime::createFromFormat($defaultFormat, '2019-03-10');

$data = $calculator->calculateMonthlyCycle($startBillingDate, $stubCurrentDate);

echo $data['start']->format('Y-m-d') . PHP_EOL;
echo $data['end']->format('Y-m-d') . PHP_EOL;

outputs

2019-02-15
2019-03-15