PHP code example of phpmentors / domain-commons

1. Go to this page and download the library: Download phpmentors/domain-commons 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/ */

    

phpmentors / domain-commons example snippets


namespace MyDomain;

use PHPMentors\DomainCommons\DateTime\Date;
use PHPMentors\DomainCommons\DateTime\Period\DailyIteratableInterface;
use PHPMentors\DomainCommons\DateTime\Period\DailyTrait;

class DailyPeriod extends Period implements DailyIteratableInterface
{
    use DailyTrait;

    public function __construct(Date $start, Date $end)
    {
        parent::__construct($start, $end);
        $this->it = $this->iterate(); // this line enables iterator
    }
}