This is a library with a few dates helpers for using at reports. Mainly getting an array of dates to use for querying and/or displaying
This package can be installed via Composer by requiring the
davispeixoto/dates_for_reports
package in your project's composer.json
.
{
"require": {
"davispeixoto/dates_for_reports": "~1.0"
}
}
Or
$ php composer.phar require davispeixoto/dates_for_reports
And running a composer update from your terminal:
php composer.phar update
Here is a common usage example.
<?php
use DavisPeixoto\ReportDates\Dates;
$date_helper = new Dates();
$weeks = $date_helper->getWeeksBreak($from, $to);
foreach ($weeks as $week) {
$businessDaysAmount = $week->getBusinessDays();
// do something with dates here
}
Please find out more about usage and use cases.
This software is licensed under the MIT license
This project follows the Semantic Versioning
This package strive to have the best as of now to ensure its quality. We count on unit tests, behavior tests and static analysis tools.
Several static analysis tools are used to ensure a good design and architecture.
- PHP Mess Detector
- PHPStan
- PHP Code Sniffer (we use PSR-2 style)
- PHP Code Sniffer Fixer
The first two gives some metric of cyclomatic complexity and naming conventions. The last two are the basic for ensure we have the proper code style (PSR-2).
We also can count on PHPStorm/IDE related inspections.
The directory features has all .feature files, written in Gherkin. The subdirectory bootstrap contains the BDD-implementation of Behat classes.
We do not create CRUD features, but all business rules should be written here, through examples.
The tests directory has the unit tests, written in phpunit 6+, and strive to follow the rules:
- They are designed to test all entities and services
- Simple getters and setters can be skipped
- Simple constructors and destructors can be skipped
- All business rules should be covered
- All public methods that cannot be skipped as per above rule should be tested
- All private methods should be covered through proper inputs into public methods
- It is highly recommended to use data providers for passing parameters to test methods
For all PHP community