DEV Community

Should I use PHP to make a website in 2020 ?

Hari Prasad on December 01, 2020

Collapse
 
zeppi profile image
Giuseppe Damiani

If it is one or two pages without translation and without database then, personally I would say no. Do it in HTML or JS (VueJs). I recommend limiting server dependencies.

If your site require more, I agree with the general opinion that PHP is fine for making sites.

Collapse
 
hariprasad profile image
Hari Prasad

I have done a couple of projects in PHP. I want know that whether should I use PHP still in my website as it is dying.

Collapse
 
zeppi profile image
Giuseppe Damiani

PHP is dying? There is no serious indicator that points in this direction. LAMP solutions are still relevant and however, it is its solutions that could change (dying) to make way for the cloud solution. (docker, k8s, etc) Most PHP solutions have taken this direction with API backends and JS in front. This is proof that PHP continues to be in the race but with more competitor (python, ruby, node, etc..)

Collapse
 
btlm profile image
btlm

Never trust online "experts" and other languages' fanboys. PHP is not dying; more - it is becoming more popular. Still LAMP stack is probably the cheapest way to host small or medium traffic site.

Collapse
 
joppedc profile image
JoppeDC

As most people suggest, PHP is perfectly fine for websites. But i highly suggest using a framework. Personally, i prefer Symfony over anything else.

Collapse
 
dakujem profile image
Andrej Rypo

Symfony for larger apps, Laravel for rapid prototyping, and Slim for light APIs.
Slim itself is not really a framework at all, but you'll get to build your own stack from stuff that suits your needs and scales.

Collapse
 
walternative profile image
Gregor Beyerle

Speaking as someone who doesn't really like PHP: modern PHP is pretty fast and not any worse than any other backend languages. If you already know it and need to get something done there is no harm in using PHP. Just don't roll all your own stuff (especially authentication, DB access, etc). If you aren't already using it take a look at CakePHP or Laravel. If your daily driver is a Windows machine I'd suggest you might want to develop using another language, because doing PHP on Windows is very annoying (disclaimer: my opinion).

If you're looking for an alternative: Python is nice. Django is a Ruby-on-Rails like one-stop-shop solution for classical web applications which should carry you for a while. Other than that the language is more general purpose than PHP - this is only a pro if you want to do something different than backend heavy web applications, though.

Collapse
 
dakujem profile image
Andrej Rypo

Python might currently be the most popupar lang in general, but if you already know some PHP, I would recommend using it for web projects of any size.

I would suggest using it for what it is best: backend & data serving. If you are building a frontend-heavy interactive web app (not like a blog), use JS for the front end, or use JS for the interactive parts (like Vue). The interactivity is where PHP (but also Python or any backend lang) lacks.

As for Windows, I am a long term Win/PHP programmer and I can say there is no problem with windows and PHP at all. Nowdays you either use Docker or some other VM anyway, or can comfortably install native PHP (even multiple versions of it) and nginX or Apache. I might even post on this topic in near future.

Collapse
 
_garybell profile image
Gary Bell

Around 1/3 of the Internet run Wordpress. NASA uses Drupal. Adobe bought Magento. All of these run on PHP. It's very much an alive and popular language, so there's no reason not to use it.

It's certainly not the only option out there, even from an open source point of view. But is absolutely a viable language to build with in 2020 (and into 2021)

Collapse
 
hariprasad profile image
Hari Prasad

Though Wordpress uses PHP there is a news that it is going to shift to node.JS

Collapse
 
_garybell profile image
Gary Bell

I'd like to see more information on that. The branches on the Github repository don't support that news - unless it's being kept out of the public eye as a side project.

The closest I can find is that the admin interface is potentially moving towards more of a NodeJS drive interface, but using the standard REST API (written in PHP) for the backend.

Collapse
 
frikishaan profile image
Ishaan Sheikh

It depends on your requirement. Don't listen to trolls, try yourself.
If you have some experience in PHP, try Laravel you'll love it.

Collapse
 
moha1234566044 profile image
Mohamed Hassan

I would say yeah why not? use pure PHP for small to medium size projects and its frameworks for big projects!

Collapse
 
dakujem profile image
Andrej Rypo

Just use a respectable framework for anything, you will thank yourself later.

Collapse
 
jamesking56 profile image
James King

PHP has come a long long way from the terribly coded scripts of the 2000s. I would say its perfect for a beginner if you need server-side logic. The only recommendation I say, is stick to Object Oriented programming and use strict types, try to steer clear of the dynamic sides of the language. PHPStan is a great tool to help with finding typing issues and has some rulesets available on GitHub for strict typing.

Collapse
 
alaindet profile image
Alain D'Ettorre

There are alternatives. It works well though and it has some advantages in some areas. That's it.

Collapse
 
jpard profile image
Jonathan PARDONS

YES ! Php is really interesting but, if you really want to build some complex and advanced website or web application, i recommand you to use a framework like Laravel.

Collapse
 
ibrahimanm profile image
Ibrahim Al-Namroty

There is a lot of alternative languages , but you should do what you better at