<?php
use Budgegeria\IntlSort\Builder;
use Budgegeria\IntlSort\ComparatorFactory\ValueObject;
$sortBuilder = new Builder('de_DE', new ValueObject('getName'));
$sorter = $sortBuilder->upperCaseFirst()
->orderByAsc()
->getSorter();
$array = [
new Foo('r'),
new Foo('a'),
new Foo('รถ'),
new Foo('z'),
new Foo('H'),
new Foo('A'),
];
$sortedArray = $sorter->sort($array);
dump($sortedArray);
class Foo
{
public function __construct(private string $name)
{
}
public function getName(): string
{
return $this->name;
}
}