How to get the current shopping cart details on the server-side (with PHP)?

A post was split to a new topic: How to get the \Magento\Checkout\Model\Session singleton in a *.phtml template?