I'm using the component (version 2.7) not the symfony framework.
I'm using PHP to inject and it is OK but I decided to use XML. I don't know how to load XML stored services into ContainerBuilder object,
I'm using the component this way:
$container = new ContainerBuilder();
$container->setDefinition('Crypt', new Definition('MiladRahimi\PHPCrypt\Crypt'));
The component is nicely documented. You'll find everything you need in the official docs.
Specifically, read on Setting up the Container with Configuration Files and Compiling the container. Make sure you dump the container for better performance.
Here's an example of loading an xml file, taken from the documentation:
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(__DIR__));
$loader->load('services.xml');