Silex Twig Library的视图/资源位置

Normally, for a Silex project, I would have top-level directories like:

- app/
   - views/
- src/
- vendor/
- web/

Now, some of my classes may call $app['twig']->render(...) and it will pull out a view from the app/views folder.

If I extract a library to be more reusable, across multiple projects, where should I keep its view files, and how do I instruct Twig to look there?

The same question applies to graphics/stylesheets, etc which I would normally put in web/.

Surely they have to be within vendor/my-lib somewhere to allow Composer to cleanly install the files? Is there a common/best-practice way to do this?

Update For reference, here's what I ended up doing:

<?php

// in my \Silex\ServiceProviderInterface ...

/**
 * @var \Twig_Environment $twig
 */
$twig = $app['twig'];

// Add the paths to our twig templates here
$fsLoader = new \Twig_Loader_Filesystem(array(
    __DIR__.'/views/'
));

$twig->setLoader(new \Twig_Loader_Chain(array($twig->getLoader(), $fsLoader)));

Thanks.

I store the views under src/{Library}/{Class}/View/

I set the base path of Twig to the src

$app->register(new TwigServiceProvider(), array(
    'twig.path' => array(
        __DIR__ . '/../src/{Library}/'
    ),
    'twig.options' => array('cache' => false, 'strict_variables' => true)
));

and when calling render I pass in the path from that point

$app['twig']->render('{Class}/View/{twigfile}.html.twig',$data);