2022-07-04, 04:04 PM
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]1. That PHP can be used as a templating language? Then you may want to read about Wordpress or Joomla which use PHP for templating.While it can be used as a templating language it is quite too powerful. For example you shouldn't be able to manipulate from a template.
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]2. Twig is a bloatware because it is an unnecessary addon on top of PHP which is slowing down dispatching of each request.A good template engine is necessary unless you have only very few templates.
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]3. Twig's security is imaginary. If someone doesn't know how to write secure PHP then he/she shouldn't be writing any commercial code in the first place. BTW Twig is written in PHPPHP allows you to access any global variable and execute literally any code. That's not secure at all.
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]4. Not even mentioning that Twig will introduce its own set of bugs and security problems and another unneeded obstacle during a deployment and debugging.Twig is not that complex and compiles templates into plain PHP.
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]5. If you are concerned about things like <?php echo $item_caption ?> then you can sanitize the variable before sending it to the template or use htmlspecialchars() in the template <?php echo(htmlsepcialchars($item_caption))?>. For more complex HTML output there are third party PHP functions such as htmlawed() which purify/sanitize the output.That's more code and less readable.
(2022-07-03, 11:02 PM)jimski Wrote: [ -> ]6. BTW, Twig claims to be fast, just like Laravel calimed the same nonsense. Here is the comparison of pure PHP vs the Laravel bloatware which should be called "Larval" :-)You are not using Laravel because it's fast but because of all the features it has. Developing is so much faster with a framework when you start implementing your application instead of writing all the boilerplate yourself.
(2022-07-04, 05:32 AM)jimski Wrote: [ -> ]And Wordpress is a pretty good standard to use as a reference in 2022, as it commands 50% of the CMS market.Just because a software is popular doesn't mean its code is good or based on modern standards.