Replies: 2 comments 2 replies
-
Something I don't understand: how does it work when you modify a PHP class in your project? The server has to be restarted, because you can't redefine a class that's already been defined. |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
You can call |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use Twig in a ReactPHP project, but it seems they are fundamentally incompatible. If I understand the docu and the code correctly, Twig assumes that for each request the PHP engine gets "reset" so that all loaded classes are gone again – which in ReactPHP of course is not the case.
I think this is the reason why I am unable to get Twig to reload my templates when I change them – I always need to restart my ReactPHP app, which during development of course is a no-go (it's near impossible to write and improve on templates that way).
I am down to creating a new Environment instance for each request and setting cache=false and auto_reload=true - but the generated classes are not re-generated when I change a template. The name of the generated class does include a hash but that does hash not depend on a timestamp or similar and therefore once the class exists inside the ReactPHP app's code it will not go away and of course cannot be "updated".
Am I missing something fundamental here or is Twig really not usable with ReactPHP in a way that lets me re-load changed templates without re-starting my app?
Beta Was this translation helpful? Give feedback.
All reactions