To give you a runnable sample:
Install Twig in empty project:
composer require "twig/twig:^3.0"
Create the following "test.php" file:
render('demo.twig', ['name' => 'Fabien']);
Create the view:
mkdir templates
cd templates
echo "Hello, {{ name }}!" > demo.twig
Run the demo:
cd ..
php test.php