Live data from Hacker News

PHP – The Right Way

phptherightway.com

121–130 of 349 posts

Re: PHP – The Right Way

#121
post #115

Earlier quoted context omitted.

We use Asp.NET and it is a giant surprise how good it is. We are unix ppl, Linux & MacOS so not a MS shop at all. We deploy to on-prem and AWS so no Azure.

Same here, the latest asp.net is definitely one of the best performing options out there (maybe except rust in this list), and C# is a great general purpose language to code in (despite the legacy that's in there, like the reflection going on in the framework. unfortunately).

Kotlin + IntelliJ is a neat mainstream option too. For those preferring a bit less legacy.

Re: PHP – The Right Way

#122

A language that changes the semantics of functions between minor versions has no "right way". "count()"less examples of crap. I have currently two weeks of code migration behind me because code running correctly on 7.0 fails on 7.3 -- while I see the reason for change was necessary I also see the hopelessness of rebuilding a flawed house with a fundament build on a pile of manure. And the good news given to me by a c…

[deleted]

Re: PHP – The Right Way

#123
post #6

Earlier quoted context omitted.

In the mid-00s the main selling point of PHP were shared hostings with mod_php which was a cheap way to host your own web site and database. Now with the cloud that advantage is utterly gone.

I am not quite sure if Jamstack has improved anything. I feel like the entire web stack is spinning wheels and hardly progressing.

It's moving somewhere from "not quite there yet" to "substantial, qualitative improvement" as we speak. I'm following what happens in that space with React/Node based things like Next, and Redwood (soon v1.0), and others. The building blocks are there and the integrations get better and better.

The big win of those will be tighter frontend and development integrations that are just not as feasible with a different language stack (PHP/Laravel, Python/Django, Ruby/Rails).

Re: PHP – The Right Way

#124
post #11

Earlier quoted context omitted.

PHP share-nothing architecture is awesome. It's amazingly simple and it scales to arbitrary size.

Complicated frameworks means the “shared nothing architecture” is unusable and you have to use fcgi/fpm to get acceptable performances out of your website. At which point there’s little difference from .

What's wrong with FastCGI? PHP provides a CGI-like model regardless of which interface to the web server is actually used.

Re: PHP – The Right Way

#125

A language that changes the semantics of functions between minor versions has no "right way". "count()"less examples of crap. I have currently two weeks of code migration behind me because code running correctly on 7.0 fails on 7.3 -- while I see the reason for change was necessary I also see the hopelessness of rebuilding a flawed house with a fundament build on a pile of manure. And the good news given to me by a c…

I've upgraded quite a few PHP systems, and 7.2 was the major stumbling block that I've seen for most projects. Which "changes the semantics of functions between minor versions" are you referring to? In the 7.0 update there was the changing of order that e.g. $foo[bar]->boom[baz] would be evaluated, but obviously that isn't your complaint.

Re: PHP – The Right Way

#126
post #90

Earlier quoted context omitted.

Java, .net, C#, typescript (not my favorite) are all commonly and often used for Web Development. They are sane languages with large ecosystems and solid frameworks for web-dev.

The question is not can you use something else, it's are they nicer/better tools to work with. I haven't for example seen many things that can honestly compete with WordPress. When it comes to eCommerce, not many systems can compete with Magento/Spryker/Sylius. The list goes on. PHP is a top player in web development while being one of the most hated languages for a reason. I've spent a lot of time using PHP professi…

> I haven't for example seen many things that can honestly compete with WordPress.

I'm sorry? Compete on what parameters?

Almost all frameworks win, hands down, in developer-friendlyness from WordPress. Many, if not most, modern CMSes can easily compete on security or performance. Many CMSes will win in user-friendlyness - for distinct use-case even more so. Many web-frameworks win easily in versatility: there's no way you can build a solid payment-service-provider in WordPress, build a Bookkeeping app, CRM, project-management, etc in WP. Yet these are fine in Java, .net, Rails, Django or even Rust.

The only place where I consider WordPress king, is for standalone, reasonably simple, blogs. This is a giant niche.

* standalone: not integrated into CRMs, or editorial workflow software. reasonably simple: no complex editorial and publishing workflows. blogs: anything slightly more than simple brochureware, but simpler than an avera CMSes.

Re: PHP – The Right Way

#127

Earlier quoted context omitted.

Come on, CPUs aren't bedroom project hacked to write a bit of HTML. The depth of knowledge required to make one chip dwarfs all of PHP powered websites.

How about "there are no sides only progress in different areas"? I'm not saying writing PHP is more "valuable" than designing chips. Besides that, what does that have to do with anything mentioned in this very thread?

You mentioned computers hardware. But computers are not a shim like PHP. It's surprising if not disturbing people think PHP is a progress of any kind. But at least it's improving.

Re: PHP – The Right Way

#128
post #20

My problem with PHP is that it solves the issue of code reuse the wrong way round. In other languages, you can import code like this: import mail as mailer The external code ("mail") does not have to make assumptions how it will be called when it is used. In PHP, it is the other way round. Every piece of code needs to try avoiding namespace conflicts by prefixing the code with something like this: namespace Illuminat…

Namespaces in PHP are totally fake, they are not real as it is in C++, where you can actually store data within them.

In PHP the namespace is just a name added to every class construct and nothing else.

This is basically

  class MyThing
the same as this

   namespace My;

   class Thing
However namespaces was a pragmatic design choice that solved the community's problem with code organization and ever increasing project sizes and for that it worked pretty well because introducing namespaces didn't break any existing workflow.

Today though I agree that proper module system would be nicer and now with PHP evolved even further it is perhaps time to introduce them.

Without having deep knowledge about PHP internals it feels like it would be possible to do because you can already today implement your own module system. Here is just something quick & dirty as a proof of concept.

module.php

    
main.php

    helloWorld('Module system');
    
    $other = module('module.php');
    assert($my === $other);
    
The building block in PHP internals is the class - interfaces, traits and enums are all classes in disguise. Could it be possible to use classes for modules as well? Perhaps just add some syntactic sugar on top.

Re: PHP – The Right Way

#129
post #11
post #5

But what's the point? The beauty of perl scripts, and later php templates, was in their BASIC-like simplicity. They were not secure or structured in any way, but very accessible. Once you add these frameworks, you realize you could have started with Python or Java in the first place and get more mature infrastructure and better language along the way.

PHP share-nothing architecture is awesome. It's amazingly simple and it scales to arbitrary size.

> PHP share-nothing architecture is awesome

There's nothing PHP specific about share-nothing architecture. It's often refereed to as stateless application layer in other camps.

Re: PHP – The Right Way

#130
post #126

Earlier quoted context omitted.

The question is not can you use something else, it's are they nicer/better tools to work with. I haven't for example seen many things that can honestly compete with WordPress. When it comes to eCommerce, not many systems can compete with Magento/Spryker/Sylius. The list goes on. PHP is a top player in web development while being one of the most hated languages for a reason. I've spent a lot of time using PHP professi…

> I haven't for example seen many things that can honestly compete with WordPress. I'm sorry? Compete on what parameters? Almost all frameworks win, hands down, in developer-friendlyness from WordPress. Many, if not most, modern CMSes can easily compete on security or performance. Many CMSes will win in user-friendlyness - for distinct use-case even more so. Many web-frameworks win easily in versatility: there's no w…

The fact you're talking about building a payment service provider in a CMS kind of tells me this isn't a conversation worth continuing.
Post reply on HN