DEV Community

loading...

Discussion on: Choosing PHP in 2018

Collapse
xowap profile image
Rémy 🤖

Look, PHP might be a not-so-terrible choice to create a website. I've myself been using PHP before register_globals was defaulting to false. I agree, it's workable. I've been using it professionally for years.

Yet, at some point I spent 1 month creating a project with Symfony (that was my first project and an old Symfony version). As I was not happy with the result, I did the same thing again but this time using Django. It took me about 3 days (that was my first time using Django and using Python as well).

Now Symfony has changed (I gave a it few tries in between 2008 and now) yet nothing from the PHP ecosystem managed to get my heart ever again.

We're in 2018 and now most of what we do is SPAs with just an API backend to be written in the language of your choice. What matters is the quality of the ORM and the ease to create a REST API. Well, the Django ORM is really a gem in this world. Amongst all its features, I like the most:

  • Its migration system, which is deterministic and plays well with branching
  • Its introspection capabilities which allow to create your REST API mostly automatically based on your data schema (and this without shady code generation)

I know that Laravel or Symfony kinda have that. But it's just not as good.

So, no PHP for me sorry.

Collapse
restoreddev profile image
Andrew Davis Author

Everything has its quirks, including Django. If you like Python, then go for it, but you can make just as good of an app in PHP. If you’re looking for an automatic REST API, PHP has Apigility. Laravel now has some efficient facilities for creating JSON APIs as well.

Collapse
aturki profile image
Ali Turki

At our company we use PHP and Symfony on a daily basis.. the framework is so awesome and so weel thaught thst we decided to settle for Symfony for of our applications. Doctrine (the defacto ORM/ODM) has an excellent support for relational and non relational DBs. As a result, we are actually working on a set of bundles (like a zero conf admin generator) that improve the framework capabilites out of the box. In my case, nothing to complain about in thr PHP ecosystem (except maybe the $ sign. But that's a matter of personal taste)

Collapse
ellisgl profile image
Ellis

Doctrine tries to support everything, but has several issues since not all DB supports certain features. Cross db foreign keys are not support, and IIRC there's an issue with date/time type columns defaults of null(?). The last one, there's an easy work around. The first one, there is a code mod you can do, but modding the library will end up with issues later on when you want to upgrade.

I actually like the '$' variable prefix.

Thread Thread
xowap profile image
Rémy 🤖

I didn't think I'd take the defense of Doctrine one day but in the case of cross-DB foreign key the reason is pretty simple: it makes no sense at all.

Maybe your application can't get around it but if you ask me, solving this at ORM level is like the most convoluted and misleading way of doing it. Just saying.

You'd better treat it as an external service like an API or something in that mood...

Just my 2 cents

Collapse
meduzen profile image
Mehdi M.

You would probably love Laravel: it has, among a lot of other stuffs, a wonderful ORM (Eloquent) and a great migration system.

Collapse
xowap profile image
Rémy 🤖

That's true, it kinda reminds me where Django was 5 years ago :)

Thread Thread
xicarus profile image
Sergiu-Lucian Petrica • Edited

Yet judging by the subtle acidic remarks you're trying to make, it's clear as day that you still haven't actually tried building a proper app with Laravel even though I invited you to do so in the past.

You're biased as hell against PHP. It's easy to tell because in every other PHP post on this site I see you trying to convince people how Django is better. We already understand, you like Django and there's nothing wrong with that. Your reasons for liking Django however make sense to you and you alone.

To counter your little 'remark', if Django was so much more 'advanced' like you're trying to insinuate maybe that 0.25% marketshare that isn't really increasing was bigger. And I'm not even saying Django is bad, I think it's a very good framework backed up by a coherent language. The simple truth is that Django never brought anything new or significant enough to the table in order to displace a significant amount of marketshare, no matter how much you like it.

Do yourself a favor and actually build something with Laravel or even Lumen before you once again repeat the same single nitpicky anti-Laravel argument you have. Laravel and Lumen's strengths are something you should get educated about. If you're refusing Laravel because of some minor ORM issue that you can work around I'm afraid you haven't been paying attention, and once again proves you don't understand its strength.

You remind me of the people who laugh at TYPO3 CMS. Then at some point in their lives, they need a system which supports highly custom multilingual websites very well. That's the moment they stop laughing.

Thread Thread
olal profile image
(ⓞⓛⓐⓛ 🇰🇪 II)

Say no more 👏👏👏👏

Thread Thread
xowap profile image
Rémy 🤖

Ah but I learned, the last time we had this argument I didn't try to convince anyone to use Django and then I was urged to give the solutions I had in mind.

I guess giving alternatives wasn't a good strategy either then.

My point is still the same, PHP doesn't make sense and trying to make it better gets me tired.

What makes it clear that I havn't tried it? That I still haven't changed my mind?

Thread Thread
xicarus profile image
Sergiu-Lucian Petrica • Edited

The fact that you're still ranting about the ORM with complete disregard to the framework's strengths makes it clear you still haven't tried it. I already suggested that.
Developers appreciate Laravel's clean and beautiful code, you can easily understand what's going on just by glancing over it (more so than your average framework). This makes development a pleasure and is the main reason why Laravel completely trampled its competitors (like Symfony, CodeIgniter or Yii) even though it's the newer kid on the block.

Lumen is a microframework based on Laravel. The fact that you can seamlessly transition towards the full framework if you want to is its main strength. It aims to address Laravel's slower nature by having the granularity of only using the features that your project is actually using.

PHP always made and will make sense for a long time, it's your anti-PHP opinion that prevents you from seeing it. Right now aside from the standard library inconsistencies (which really mean nothing if you're using an IDE) the language is actually very good.
Improving its weaknesses is a sign that the language will be with us for a long time from now on, to your obvious dismay.

Thread Thread
xowap profile image
Rémy 🤖 • Edited

The reason I'm ranting about the ORM is because nowadays it's 80% of what matters to me in a server-side framework. If you're fine representing your models as a stack of migrations you have to hold in your head I guess you'll have a better memory than I do. If you're fine merging migrations that will run in random order you'll probably get rich in Vegas.

None of 100-something files generated by default nor controllers you have to create will be as readable as the code you don't have to write when doing the same thing with another framework not so slowed down by the language's flaws.

I used to see the beauty in PHP and now I see the truth. It made me lose long hours I could have spent doing something else. Every time a client requires me to code PHP is a painful reminder of that.

But then again, if Laravel floats your boat then go for it, be free. You're the only judge of what you need. (This sounds sarcastic but it's not)

Thread Thread
xicarus profile image
Sergiu-Lucian Petrica • Edited

Migrations in random order? What do you mean by that? Laravel's migrations are very much executed in the order of creation date (you can change that order if you really want to but to be frank I never needed to do that).

It sounds to me like you're required to support older PHP versions, because PHP post-7 is actually a decent piece of language and is fun with a good framework. I'm not confident about you being up to date with the current PHP ecosystem, that's all.

Likewise, if you like Django that's perfectly fine. I think it's great too. But again, I think your reasons for preferring are alien. Perhaps your projects are different than mine and that's why.