Live data from Hacker News

PHP in 2022

stitcher.io

231–240 of 318 posts

Re: PHP in 2022

#231
A lot of people here have mentioned Laravel. I think one of the key things about Laravel is that the creator, Taylor Otwell, is only focused on Laravel. Imagine if DHH didn't ever have Basecamp (or 37 Signals) and only focused on Rails and the Rails ecosystem. The Laravel team now has several full time employees working on making the entire Laravel experience as painless as it can be.

Of course Taylor and the Laravel team have paid products, but they are all 100% focused on the Laravel ecosystem and developer experience!

Some of the things that the Laravel ecosystem has as first party packages / services:

Paid:

• Vapor - Serverless Platform. Run your vanilla Laravel apps on Lambda.

• Forge - Server Management. Builds Laravel ready servers on any cloud.

• Envoyer - Zero Downtime Deployment. Deploy your apps with push-to-deploy.

• Nova - Administration Panel. Completely code-driven admin panels.

• Spark - SaaS App Scaffolding. Basically a SaaS starter kit.

Free:

• Horizon - Queue Monitoring. Like Sidekiq

• Jetstream - App Scaffolding. SaaS starter kit with teams, invitations, api, etc.

• Echo - Realtime Events. Think Pusher, Socket.io, etc.

• Sail - Local Docker environment.

• Valet - Dev Environment for Macs.

• Mix - Webpack Asset Compilation. A sane wrapper around webpack.

• Cashier - Subscription Billing Integration. Stripe + Paddle.

• Dusk - Browser Testing and Automation. First party browser automation for tests.

• Sanctum - API / Mobile Authentication.

• Laravel Scout - Full-Text Search. Wrapper around Algolia, Melisearch, or full-text database searching

• Socialite - OAuth Authentication. Log in with GitHub, Google, etc. Dozens of community packages as well.

• Telescope - Debug Assistant.

That's all first party. It's unbelievable to me how many batteries are included. Then you start looking at the surrounding ecosystem beyond that and it gets even crazier.

Laravel as a community is an extremely welcoming place, and I have found that most people care deeply about their code and architecture, but don't pick each other to death on details that don't matter. I think all in all it's a pretty pragmatic group.

If you haven't checked out PHP lately because you think we're writing a file-per-page and FTPing them up somewhere, you should give Laravel a look.

Re: PHP in 2022

#232

Wow, Php almost catches up with majority of programming languages!

Can't wait for: - Pattern matching in switch statements (done horribly wrong) - If, while, and switch expressions - Inferred type system - Consistent array method argument order - Actually usable higher order functions and reflection Big reminder: Php is a fractal of bad design, and I intensely hated using it at work for many years. The only good thing in Php is Symfony2 framework. https://eev.ee/blog/2012/04/09/php-…

You could have googled and hated better. Why bother trolling if you won't even give it 40 seconds of using search engines?

Re: PHP in 2022

#233
post #216

Earlier quoted context omitted.

Storing stuff in a json file sounds horrible to me. Why would you want that?

Because your data is teeny tiny, not performance critical, and `json.load` and `json.dump` is easy and usually less brittle then you're language's marshalling library.

Why save 10 minutes on setting up a proper database? Data is never teeny tiny, data is never not performance critical :) These decisions only bite you in the ass.

Re: PHP in 2022

#235
post #185

Earlier quoted context omitted.

I've being used PHP since it was Personal Home Page (3.x or something). The reason I moved away from it, is it is language make up. Some point around 4 it try to become Java OO style (ok ES6 is trying to do that too). The main reason moving away from it is because would like to have language that has function as a first class citizen, and JS seems to fit the bill. Once I found the joy of developing with proper closur…

PHP supports first class functions though?

While PHP is adding a First class callable syntax in 8.1, first-class-functions have been available in PHP since 5.3.0 (Released Jun 2009) going by the Wikipedia definition:

> This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.

Ref: https://stackoverflow.com/a/59293198/368328, https://3v4l.org/rQGk2

Re: PHP in 2022

#236

Earlier quoted context omitted.

> It evolved a lot, but I don't see it outside of simple backends for websites. I'd say that something like MediaWiki, Wordpress or Drupal exceeds the definition of "simple backend". Personally, I even tend to write shell scripts in PHP simply because the language is far more sane than Bash (and god forbid naked old sh) and I don't have to fight whitespace with Python.

Isn't it funny how (ba)sh always gets a pass and PHP is hated even though bash is a complete insanity?

Does anyone think bash is good though, like some people on this thread seem to believe about PHP?

Re: PHP in 2022

#238

Earlier quoted context omitted.

Laravel and Livewire is the best-kept secret ever because everybody is too busy being biased against PHP.

Or we're too busy using Phoenix LiveView ;P

One of the companies I worked for used Elixir/Phoenix. It is an extremely cool piece of tech but it is nowhere near as productive as Laravel, Rails, etc. Missing libraries, difficult to hire for, bad editor support, and overall feels very niche which such a small community. That company eventually moved out of it.

Re: PHP in 2022

#239

Earlier quoted context omitted.

I mean, it clearly has them; it's part of the syntax. You can skip them, and the parser will insert them for you; but the language has them.

yea but its optional so does it matter? In PHP its compulsory, right?

Sometimes the extra options can produce unexpected problems. For example, in JavaScript, this would return nothing and may result in an unreachable code warning:

  function go() {
      return
          5 + 3;
  }
  console.log(go())
Since semicolons are optional, it's treating "return" as its own statement and "5 + 3" as a separate one.

There are no hidden gotchas like this in PHP though since semicolons are always used:

  function go() {
      return
          5 + 3;
  }
  var_dump(go());
This will return int(8).

Re: PHP in 2022

#240
post #159

Earlier quoted context omitted.

In a world where everything is fast becoming a JavaScript front end with “some” backend and with the improvements PHP has seen in recent years I don’t see why you’d consider yourself a “lowly” php developer. I’m mainly a C# guy myself as far as the backend goes, but I don’t view PHP as being bad in 2022. I think people who do are stuck in the past to be perfectly honest. It’s sort of like disliking JavaScript because…

> why you’d consider yourself a “lowly” php developer. PHP has always been considered as a somehow bad language in all corporations I've worked at to date. The same applies to other script languages such as python, ruby or nodejs - but PHP was the most undervalued of them all. It's kinda strange because the language is really performant and relatively easy to use. Maybe that's exactly why the big brain architects don…

People dislike PHP because its standard library had many inconsistencies and interesting design decision that no sane programmer would ever even think off, like all random numbers being odd (https://stackoverflow.com/questions/31612082/why-does-mt-ran...).

Many of these decisions revolve around the authors not wanting their functions to fail under any circumstances. This is nice for beginners but quickly hurts more than it helps in larger projects as it obfuscates bugs.

Post reply on HN