1. Go to this page and download the library: Download burobo/ukon 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/ */
burobo / ukon example snippets
use Ukon\Unit;
class Metre extends Unit
{
/**
* @inheritDoc
*/
protected function languageSpecificFormats(): array
{
return [
'default' => '%s metre',
];
}
/**
* @inheritDoc
*/
protected function globalFormats(): array
{
return [
'abbr' => '%sm',
];
}
/**
* @inheritDoc
*/
protected function domain(): string
{
return 'messages';
}
}
use Ukon\Type;
class Length extends Type
{
/**
* @inheritDoc
*/
public function __construct(int $scale)
{
parent::__construct($scale);
$this->registerUnitRatio(Metre::class, 1000);
$this->registerUnitRatio(Centimetre::class, 10);
$this->registerUnitRatio(Millimetre::class, 1);
}
}