lubos / cakephp-interval
Interval plugin for CakePHP
Installs: 111
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.5.9
- cakephp/cakephp: >=3.3.2 <4.0.0
Requires (Dev)
- cakephp/cakephp-codesniffer: dev-master
- phpunit/phpunit: *
This package is auto-updated.
Last update: 2025-02-04 19:37:45 UTC
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require lubos/cakephp-interval
Load plugin in bootstrap.php file
bin/cake plugin load Interval
Usage
In human readable string, following can be used
w = week
d = day
h = hour
m = minute
s = second
$Interval = new \Interval\Interval\Interval(); // output 2w 6h echo $Interval->toHuman((2 * 5 * 8 + 6) * 3600); // output 36000 echo $Interval->toSeconds('1d 2h');
You can use ./src/Traits/IntervalTrait.php
or cakephp component / helper.
Helper example
// in AppView $this->loadHelper('Interval', ['className' => '\Interval\View\Helper\IntervalHelper']); // in Template, output 2w 6h <?= $this->Interval->toHuman((2 * 5 * 8 + 6) * 3600) ?>
See ./tests/TestCase/Interval/IntervalTest.php for more examples
Bugs & Features
For bugs and feature requests, please use the issues section of this repository.
If you want to help, pull requests are welcome.
Please follow few rules:
- Fork & clone
- Code bugfix or feature
- Follow CakePHP coding standards
- Unit tests