like text(), innerText() also trims whitespace characters by default, but you can get the unchanged text by passing FALSE as argument $text = $crawler->filtrXPath('//body/p')->innerText(false);
https://symfony.com/doc/current/components/dom_crawler.html