My PHP Development Setup

prostoalex | 340 points

Glad to see modern PHP getting more coverage on HN. For anyone interested in how the latest version performance compares to similar languages checkout vs Python [1] and the vs Ruby [2] pages from the benchmarks game team.

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

[2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

tylerjwilk00 | 5 years ago

PHP community did an exceptionally excellent job to improve standards in the past few years. A lot of features has been added to the language itself as well as huge performance improvement.

Many complain about PHP is from the past. Still a lot of developers just hacking around but it is not hard to find decent PHP developers anymore.

stunt | 5 years ago

> Most developers use Makefiles

I disagree. I'll argue that most of the new crop of developers are self-taught/bootcamp-trained/career-switching and they straight to the web. For RoR, Node.js, Python, Go, etc. it's not a common setup and those are the languages being learned today.

Now if we are talking about the public who has a "I remember when I started with PHP" nostalgic feeling while reading this article I might agree, but that is not "most developers" :)

franciscop | 5 years ago

Uhm... I didn't know that makefiles are that easy. Last one I looked at one it looked like it could run a spaceshuttle. Lot's of crazy stuff. Thought it would be super complicated, but now.. well.. will try this out.

Kovah | 5 years ago

I really enjoy articles like this. In fact if anyone know some high quality resources of modern PHP, please give me some pointers. I am somewhat proficient in programming, and a recent project requires me to work in PHP. I know people in the industry likes to make fun of php's design flaws and quirks, but a few weeks in, I feel it is alright. The community around it are making solid improvements. The only frustrator is that once too often when I search something the top results are all W3C school tutorials from 2004.

tonysickpony | 5 years ago

I don't know why people get so bent about Makefiles. Its a way to preserve muscle memory using a universally (well most *nix systems, anyway) available software.

It allows you to have package your often used shell commands into one well known (even a 30 year manual will teach you how to read/use a makefile) file.

FraaJad | 5 years ago

I'm doing it in a really weird way, and I'm probably alone in this setup:

1. Various IDEs on my Windows machine writing PHP & HTML/CSS.

2. Saving all files over Samba to a Debian Web Server running Apache.

3. Once the code is complete and signed off, it's migrated to a production server.

4. Have a global error hook via 'set_error_handler' in each PHP file that 'echos' out the problem into the Browser. This doesn't help me with syntax errors though.

I'm fairly new to PHP development (Previously .NET dev), so I'm probably doing many things wrong here, and I'm totally open to suggestions, however I DO have to stick with Windows as my dev machine.

Jaruzel | 5 years ago

Makefile for essentially a bundle of shell aliases? Weird flex for PHP but ok.

efficax | 5 years ago

Modern PHP is much better than the old one. One feature I miss from Kotlin are Infix-Functions: https://kotlinlang.org/docs/reference/functions.html#infix-n...

Even the newest PHP feels somewhat dated, Infix-Functions could reduce a lot of typing by making library and custom wrapper code – which almost always exists – resemble more.

  function foo(String $s) {...}
  // current function call syntax 
  foo('hiho');

  // just syntactic sugar - below code is the same as above
  function String.foo(String $s) {...}
  'hiho'->foo();
thibran | 5 years ago

Mine is a a lot simpeler, install Xampp with desired php/mysql version and im ready to go.

GrumpyNl | 5 years ago

I've struggled for years for a decent PHP IDE, I've used everything from nano, to vi to Eclipse, I even developed my own in PHP using wxwidgets (wxphp) which fell to the wayside when PHP7 came along and the support for wxwidgets was dropped. I used PHPStorm a couple of times but had various issues and finally I have settled on Atom[1] which in the almost 20years I've been developing in PHP must say is hands down the best IDE for PHP yet... and it's free.

[1] https://atom.io

xd | 5 years ago

Really nice article! Didn't know about the .editorconfig file. Thanks for the tips! Just wondering how are you deploying your php apps now ?

Scullwm | 5 years ago

Is Php becoming popular again?

s3nnyy | 5 years ago
[deleted]
| 5 years ago

Modern PHP is light years ahead of the procedural spaghetti-fest of yesteryear.

Craft CMS is fantastic, built atop Yii 2:

https://craftcms.com/

https://www.yiiframework.com/

juddlyon | 5 years ago

Another commentator mentioned xampp.

For developers on Windows, I think Uniform Server[0] is really good. It's completely portable and gives the full stack as well.

[0]http://www.uniformserver.com/

thunderbong | 5 years ago

Is this all in use in some private repos? I went poking around on the author's github for some examples (I've never used docker compose before, what on earth is that 'app' thing?) but I can't find anything like what is described.

kingosticks | 5 years ago

I doubt there's any other programming language here that did such a tremendous job over the last decade on improving developer experience, language speed and syntax with consistency. ps. i was writing my first sites with php3.

llIIllIIllIIl | 5 years ago

Nice to see more PHP coverage. I personally think people should move along and stop this "why would I choose PHP for a new project" nonsense. It's time to get over it.

pachico | 5 years ago

> jumpin is just me being lazy saving me typing docker exec -it <container-id> bash

The command uses run though? Is that a typo? (Really eager to try this setup.)

Kiro | 5 years ago
[deleted]
| 5 years ago

Good piece, and nice to see a local lad on here. waves from Park Square

dan_m2k | 5 years ago

Anyone else has problems with the usage of the word “modern”?

“Modern x written in y” etcetera. To me this often is a sign to not having to read it. As if you would make or do something new in oldfashioned style without mentioning it. Eg: “what my php setup was on amiga in 1985”.

Just call it “my take on a good php setup in 2019” or something. The setup is retro in januari 2020.

Anyways, I accept the down votes.

To me this is just another setup which slapped together a bunch of fancy pancy tools. Why is docker required? I use docker a lot, but to build containers and deploy apps with it. The way it is intended to be uses. Running (python) web projects works fine without docker for development. Most team mates use macos, which is linuxy/unixy enough until you do something specific.

Make is quite an old useful tool, but certainly not modern. As are linters.

.editorconfig is a thing now.

BozeWolf | 5 years ago

We are collectively losing the war for an open and safe internet. Vulnerability and services we all depend upon have proliferated with disastrous consequences. There is a better way forward and it requires us all to work together. We are empowering the world to build a safer internet. The people behind HackerOne have pioneered security at Facebook, Google, and Microsoft including Yahoo . Our head office is in San Francisco with a second office in the Netherlands. If you need a professional hacker to hack any Facebook account, Email account, phones or any device or whatsoever, contact us on info. hackerone@gmail .com Cheers

Hacker_Support | 5 years ago

And now check out my VB6 setup!

Domark | 5 years ago

"My BDSM dungeon"

aboutruby | 5 years ago

> Use a Makefile and make good use of it

Srsly?

8lall0 | 5 years ago

Would you ever choose PHP over Node.js if you don't care about hosting on shared hosting?

iends | 5 years ago

I upgraded my PHP dev setup a few years ago. The most effective thing I did was to stop developing in PHP.

willand31 | 5 years ago

Wrapping docker/docker-compose with makefiles or bash aliases is an anti-pattern, particularly on team projects.

It's a convenience to you, but it's a loss for newbies because they'll just learn that abstraction only. It's also a loss to experienced people because you're forcing your own opinions on them. I would git ignore that file.

mychael | 5 years ago