1. Go to this page and download the library: Download warrickbayman/loom 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/ */
use Loom\Loom;
use Loom\Seconds;
class MyLoomClass
{
public function translate()
{
$loom = new Loom(new Seconds(100));
}
}
class MyLoomClass
{
private $loom;
public function __construct(Loom\LoomFactory $loom)
{
$this->loom = $loom->fromSeconds(240);
}
public function translate()
{
return $this->loom->getMinutes(); // 4
}
}
$loom1 = Loom::make()->fromDays(1);
$loom2 = Loom::make()->fromHours(48);
// Equal to
$loom1->eq($loom2); // false
// Not equal to
$loom1->neq($loom2); // true
// Greater than
$loom1->gt($loom2); // false
// Greater than or equal to
$loom1->gte($loom2); // false
// Less than
$loom1->lt($loom2); // true
// Less than or equal to
$loom1->lte($loom2); // true
// Add to the end of the collection
$collection->push(new Loom::make()->fromMinutes(4));
// Add to the beginning of the collection
$collection->prepend(new Loom::make()->fromMinutes(10));
// Pull the last object from the collection
$loom = $collection->pop();
// Pull the first object from the collection
$loom = $collection->shift();
// After
$newCollection = $collection->after(Loom::make()->fromMinutes(8));
// Before
$newCollection = $collection->before(Loom::make()->fromMinutes(6));