Open event15 opened 2 years ago
@rcrowe any help available here?
Just add it to AppServiceProvider for example:
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
use Twig\Extra\Cache\CacheRuntime;
use Twig\RuntimeLoader\RuntimeLoaderInterface;
...
class AppServiceProvider extends ServiceProvider
{
public function boot() {
$twig = app(\Twig\Environment::class);
$twig->addRuntimeLoader(new class implements RuntimeLoaderInterface
{
public function load($class)
{
if (CacheRuntime::class === $class) {
return new CacheRuntime(new TagAwareAdapter(new FilesystemAdapter()));
}
}
});
}
}
Hey, I am trying to use the twigphp/cache-extra (https://twig.symfony.com/doc/3.x/tags/cache.html) extension in TwigBridge.
In
app/config/twigbridge.php
I added in extensions->enabled section an entry:When I try to use the cache block, I get an error:
The twig documentation says:
However, I have no idea where in the application to add such a loader. From what I see, extensions are added in this file:
vendor/barryvdh/laravel-form-bridge/src/ServiceProvider.php
Does this mean I should overwrite this service provider and use a custom one?