#1
Hi folks,

Since 2003 I have written view files like this:



However, I've noticed that all of the AI tools are insisting on writing view files using "alternative PHP syntax". This is something that I have personally resisted for a very long time. However, lately it feels like I'm constantly swimming upstream. So, I have decided to finally fold. Therefore, moving forward, I'm going to be gradually transitioning to code that looks more like this:



From what I understand, some of you are already using this kind of syntax and some of you prefer it. That's great. For me, I just want to reduce friction - with AI tools - as much as possible. So, hopefully this little tweak of syntax will make the framework even more AI friendly that it already is.

Here's a YouTube tutorial on the alternative syntax, for anyone who's interested:

https://www.youtube.com/watch?v=jylcOAGNzxk

Cheers,

DC
#2
Hello Dave,

Thanks for sharing this. Did you create this thread primarily for an announcement, or were you hoping to spark a community discussion?
#3
You are welcome to open up a discussion about anything you like. What's on your mind?

DC
#4
Ah that’s interesting, I hadn’t noticed that..
I have long defaulted to the “python style” aka. Alternative syntax for my views - I find it easier to code fold and it’s kinda been drilled in by uni teacher and zend & codeigniter communities way back then..
It does make sense why AI prefers it, the learning data likely has a large representation of it and a lot of comments and posts “correcting” to it..
Hmm I wonder which syntax is easier for LLMs to parse & lex for tokenization
#5
I did a live stream today where I discussed all of this in some detail. Here's a section (and I've added the timestamp) where I use six different AI tools live to see how they generate view files.

https://www.youtube.com/live/CNRZuoGX38U?si=-PVX90b20iz_auom&t=535
#6
I had some initial counter-arguments, but after watching the video, your explanation cleared everything up perfectly. I know you're already familiar with all the differing viewpoints, so I won't rehash them here. I've always been firmly in the camp of simple curly braces, but your perspective has honestly changed my mind. Thank you for bringing up this topic and for continuously driving the framework to new heights.

By the way, your video reminded me of the one you made a couple of years ago about using pixel units vs. em/rem. Pure gold. Please keep going!
#7
I’m with DC on this one. I’ve used the `{}` style in view files for years as well, mainly because that’s how the desktop app generated modules and, for years, watching DC fluidly jump in and out of PHP within view files made it feel completely natural. But the alternative syntax feels cleaner, more modern and easier to read in mixed PHP/HTML templates. Less visual noise, especially in larger views.

A little disappointing to hear of negative reactions on the YouTube video, especially when DC took the time to explain the reasoning behind the change properly. Seeing Balazs genuinely reconsider and come around after watching the explanation was great to see, though. That kind of open-minded discussion is healthy for the framework and community.

Great discussion from everyone involved. 👍
#8
Thank you.

In an ideal world we'd all be able to discuss, debate and perhaps hold an election or two with every single decision pertaining to code. I'd like that.

In this instance, it was never really a framework change - just one tweak of one view file (manage.php) that's to be produced by an as yet unfinished code generator. Because of time constraints and financial pressure I am not always able to go forward as slowly and gracefully as I would like. Unfortunately, I have to sometimes just make a decision and run with it. That's not very democratic and I can understand why that would be irritating for some.

Rest assured, the underlying framework is solid and there are no plans to change that. Indeed, I only have a few more things to build for this framework then I'll be declaring "job done".

With a Trongate finish line in sight I've started to wonder what my next big project could be. It'll probably will be something to do with web development but it won't be anything to do with PHP. In some respects I feel as if I've had enough of PHP.

We shouldn't have to choose between code that's in alignment with the language or code that's in alignment with "the standards". The only reason why this is an issue is because PHP got ruined by a self-appointed governing body who made an assortment of bad decisions.

On a positive note, I'm optimistic about what we've achieved and where we're going. Real PHP is coming back. We don't need any permission from anyone and we don't need GitHub stars. We're just doing it! Now, PHP developers have a choice - a credible alternative to "the mess". For the first time since about 2015, PHP developers no longer have to face exile if they don't bow down to the likes of PHP-FIG. That was us. That was Team Trongate. What we have achieved is super cool.

Within the next three months, PHP will be a solved problem for Trongate developers. While the rest of the PHP world toils over their next framework rewrite, Trongate developers will be able to speak an app into existence. It's the Holy Grail of web development and we are so close!

So, stand by me. It's going to be a great year.

DC