Parse the hex value, then convert the color object to OKLCH:
use PhpColor\Color\Color;
$oklch = Color::parse('#3b82f6')->to('oklch');
echo $oklch->toCss();
// oklch(0.623083 0.188015 259.815)
use PhpColor\Color\Color;
$oklch = Color::parse('#3b82f6')->to('oklch');
echo $oklch->toCss();
// oklch(0.623083 0.188015 259.815)
Read the individual channels when you need to manipulate or store them:
$channels = $oklch->getChannels();
$lightness = $channels['l'];
$chroma = $channels['c'];
$hue = $channels['h'];
$channels = $oklch->getChannels();
$lightness = $channels['l'];
$chroma = $channels['c'];
$hue = $channels['h'];
Keep the full floating-point values for calculations. Round only at the display boundary. See Convert between spaces for conversion behavior and alpha preservation.