Hacker News new | comments | ask | show | jobs | submit login
Ask HN: PHP 7 for new projects – your experience and recommendations
13 points by interfacesketch 74 days ago | hide | past | web | favorite | 23 comments
If you are using PHP 7.x for your side-project or main product, what has been your experience?

- has speed of performance ever been an issue?

- how easy have your found it to deploy (and keep up-to-date) PHP apps on the server

Overall, do you recommend PHP 7.x for new web projects? Your thoughts appreciated. Thank you.

I would highly recommend PHP for quick web development. We've been using it for all our sites and it's such a breeze to develop using it. We've never had any performance issues either (in my experience they are always more on the db end)

I'll highly recommend that you spend some time learning composer first. That is a must for any serious php development.

Then there are optional things you can learn like a framework like laravel, symfony, etc. My personal opinion is to stay away from it since I have found that a router is mostly all you need to get started quickly. Often times the headache to configure and debug the framework far exceeds the utility of it. So my own personal preference is to just use composer and a router and native PHP. Keeps things simple, easy to debug and super easy to deploy. But YMMV.

Are you advising that a beginer should implement their own auth solution ? That they will get csrf or xss handling right ?

Is interfacesketch actually a beginner? If he/she is a true beginner, that would change the entire question.

I don't know any senior web dev that need the advices you gave, nor ask question about PHP. Everybody with years of web xp has did something in php at least once or know what' s up with framework.

Two things:

1. That wasn't me who gave the advice.

2. There's a big difference between putting up a Wordpress install on PHP 5.6 and greenfielding a modern project on 7.x.

I'm currently using it for creating specific components for two customer projects. With Java, JavaScript, TypeScript and Ruby (for scripts) being my usual go-to languages, I'm not a huge fan of PHP but I'd say PHP 7 fares quite well.

It's reasonably fast. Though not part of the core language, PHPUnit is really good, as is the PHP support in IntelliJ IDEA (or PhpStorm, JetBrains' dedicated PHP offering).

If PHP is your main language or if for some reason PHP is required by your environment (e.g. if the target platform for your software are run-of-the-mill virtual servers) then PHP 7 absolutely is a good choice for new projects.

I still haven't found a language that lets me get a very basic website up and running faster than PHP.

I don't care too much for the syntax but if you just want to put up a simple page with server-side logic in as quick a time as possible then its as good as most.

Have you tried Node.js with Express and Handlebars (express and hbs packages)? It’s dead easy and fast to develop.

PHP < 7.1 goes EOL by the end of the year. http://php.net/supported-versions.php

So it's not a choice it's a requirement

I have a few decent-sized systems in different languages (PHP, Elixir, Go).

Six of one, half-dozen of the other if you ask me.

Almost any of the big ones will do, so stop sharpening your pencils, pick one, and get to work.

Speed of PHP 7 is much improved, it's way faster than 5, and fast enough for any app (Facebook runs on a flavor of PHP)

I use the Laravel Framework on PHP 7, Laravel makes PHP nice to work with. Laravel is as enjoyable as Rails, sure you miss Ruby but Laravel keeps development fun. If you are doing a project in PHP use Laravel.

I use forge.laravel.com to spin up servers and do deployments. It saves a ton of time and is definitely worth it. You could use it for any PHP project not just Laravel. There is also envoyer for zero downtime deployments. You setup Forge to pull code from from your Github/Bitbucket.

Forge is really amazing you can register a new domain, create a new Laravel project, and have it live on the web in 10 minutes. You can also add Lets Encrypt SSL certs right from the forge dashboard. Same for setting up an existing project from scratch it's fast to create a new droplet for an existing project.

If you are using Laravel I would recommend updating your apps as new versions of Laravel are released. Each update is pretty painless but if you wait to update doing them all at one time to get to the latest version can take some time.

There are lots of great time saving Laravel packages out there most require you to keep Laravel close to the latest release so it's worth staying up to date for the packages. Plus each release of Laravel always has nice additions to the framework.

Do you use frontend frameworks like React or Vue with laravel/PHP?

I'm still debating what my 2nd backend language for webdevelopment should be (besides NodeJS). Rails is highly opinionated, activeORM is amazing, has rails API mode, but it lacks native async support, and has a weird way of doing things. A lot of magic behind the scenes.

I only learned enough to know how powerful it is, and it's paradigm. I think everyone should learn it. Abstracting away rails to sinatra I've been told is painful, and I've never heard of anyone building websites with pure ruby

PHP seems appealing to me b/c it couples well with Vue, PUG (html templating). I have heard doing things other than the rails way is a nightmare, but I don't know how it is with laravel.

PHP also b/c of wordpress. I still find it superior to any alternatives (Jekyll, hugo, gatsby, etc) because of the rich plugin ecosystem, proven ground, and ability to own your comments (and not have middleware like disqus)

Rails doesn't really work with windows OS either, and I primarily use a windows machine too.

The other downside of PHP is that it's frowned upon due to developers dislike for legacy PHP codebases.

How well does PHP work as a REST API? Is Laravel highly opinionated or are there many ways of doing things inside the framework? Does PHP have native async support? I could probably look these up but I'm curious to know what your opinions are.

I created one Laravel app with React. I use vue now. Although I'm not completely sold on using Vue(or React) for the front end.

For most Apps I still build them as a traditional web app with just enough javascript/jQuery on the front end as needed.

Granted Vue is really nice, I'm sure I'll move over to using it more.

Laravel feels similar to the Rails way.

The developer of Vue works closely with the Laravel community so there is great compatibility there.

Checkout the Laracon talks Evan speaks at Laravel Conferences.

Laracasts.com is similar to Railscast.com and a great place to learn Laravel. There are some free classes to get you started.

WordPress, y I still maintain some WordPress sites, I don't enjoy it but it's the easiest way to setup a blog/content site. I have some Laravel apps that are setup to connect to the WordPress database, it works well it's easy to setup objects in Laravel to interact with Posts, Comments, Reviews, etc. This is mainly for dashboards, batch editing of comments for VAs, etc.

As far as windows, I switched to OSX when I was learning Rails. I was always having problems with Rails tutorials and would spend 10s of hours on windows workarounds.

Using windows for Laravel is a little easier. Like Rails most of the tutorials, developers use OSX. I would recommend using a mac for development. It's just easier more productive.

Even the entry point macbook air is more than capable for Laravel or Rails development.

If you need one you could probably pick up a last gen macbook air on sale (new ones just came out and are $1199) I've seen them as low as $649 but have been on sale for $799 pretty often.

Laravel works well as a rest API it is setup for api routes out of the box. There are lots of tutorials for using Laravel as the backend and interacting with vue through an api.

Native Async support included: https://laracasts.com/series/learn-laravel-mix/episodes/9

I owned a 2015 macbook pro, but I am a long time windows user, and I have a decked out gaming desktop rig.

I'll have to play around with laravel / php / vue more to see what I like. NodeJS is great and all, but it's not opinionated with it's frameworks. Too many ways of doing things. I want to build shitty prototypes quickly with a slow moving but well established framework

I like rails because it has a singular mindset. I'll have to give laravel a try.

Gaming rig? PUBG?

Was playing alot of battle royales, but lately I've been playing destiny2 and soul calibur

I use PHP still, using Laravel. So far I enjoy it. Definitely a pleasure to use. My web apps are used by at most a hundred people throughout the month, so performance won’t be an issue.

Deployment with Laravel is a breeze. I don’t use any of their deployment utilities though like Forge.

I came back to PHP. Used it back in what feels like the Stone Age. Then went through Rails when it was the new hotness. Switched to mobile and desktop development. Was behind when I needed a web project done, and knew I could fall back to my PHP skills faster than Ruby. Tried out Laravel and have been pretty happy since.

I wouldn't recommend PHP, but there is nothing wrong with it, especially not if you're good at it. Django is more productive, and react, graphql + Apollo and prisma is better in production, but really, if you're good at PHP then PHP is fine.

I wouldn't worry about it not being the fastest tech, the fact is that if it's more productive, then it's often more cost-efficient. Iron is so cheap, that if you need to spend 1-2 weeks extra on development, then you'll be able to pay for your servers for several hundreds of years until a faster tech becomes more cost-effective than something that deploys faster.

PHP7 is really fast and performance won't be an issue. It's usually another bottleneck, like the database that kills your performance.

Laravel is highly recommended these days. For even more performance you should check out PhalconPHP (https://phalconphp.com/en/). But still - I'd go with the Laravel ecosystem.

php 7 is about 2x as faster as php 5. There's no reason you shouldn't be using php 7.2+

1) performance: it depends on your case. 2) deploying: easy as uploading something via FTP.

I suggest you to use a good IDE (Atom or PHPStorm) and maybe learn a good framework like Symfony, or it would become unmanteinable quickly.

I'd recommend considering alternative options to PHP, in other projects I have found it hard to maintain over a longer period and things got messy very fast, even when using frameworks.

Also, in my opinion, it's not a very nice language at all.

Do you care to provide any actual arguments?

Don't get me wrong, your post just doesn't sound too helpful

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact