Beamtic's logo
  1. Create user
Home

Share via:

What is Vanilla PHP?

Vanilla PHP is basically plain PHP, without the use of extra frameworks and libraries to help you in the development process.

82 views

Edited: 2020-07-25 00:39

PHP, vanilla is plain PHP.

Vanilla PHP is also known as plain PHP; as the name suggests, there is really nothing special about it—it is simply PHP without libraries and frameworks.

These days, probably very few people will be coding everything themselves using plain PHP. It is much easier to find a library that does what you need it to do, and then implement that. Tools such as composer will make this much easier; but you can also find a compressed file, such as the well known .zip or the lesser known .7z, that contains the code; then you can install the library the old fashioned way.

Even something as basic as installing a library can actually be quite difficult, since it requires a solid "core" knowledge about computers and file managers. Perhaps, many of us tend to take this for granted, since we might have grown up with computers. Working with file system paths, compressing files, or extracting compressed archives, is no more difficult to me than riding a bike—just for example.

Composer is supposed to make that easier for PHP developers, and allow us to focus more on the coding of our applications.

Vanilla PHP vs Framework

Should I use a framework or stick with vanilla PHP? Well, if you already know vanilla PHP, then you also know how to use a PHP framework; that is something people often seem to overlook.

Unfortunately, if when looking for hired work, many places they might require preexisting knowledge about a specific framework, and they might even ask you about this doing the interview process. This might have the unfortunate side effect that they overlook the best programmers in the process.

It can therefor be useful to spend a few days learning about different frameworks; it is not like this is something that takes very long. I would simply sit down and try to make some basic guestbook applications using frameworks of interest. You can even keep the stuff around in your GitHub repository, as you never know when you might need to go back and see how you did something.

Vanilla PHP is not dead

There is a difference between being able to use PHP and actually knowing PHP, and being able to come up with your own solutions. To do the latter, you will need to memorize the various characteristics of the language, including the syntax of control structures, loops and conditional statements—not to mention individual build-in functions, and how to do object orientated programming in the language.

Beamtic is still developed in vanilla, object orientated, PHP; I have probably created something that looks more like my own framework by now. So, I can not exactly call it "vanilla" anymore. The original code was procedural, and I only later refactored everything to an object orientated approach.

My main reason for doing this is learning. Object orientated programming is not easy, and the best way for me to learn, is a combination of reading and applying what I learn in practice. The problem is with many of these more complex topics is that we do not normally get to use them otherwise—you probably rarely have to write your own router class if you use a framework like Symfony or Laveral for example.

This is probably the rare exception; but I am sure there is a lot of custom PHP still being developed and worked at out in the wild. This does not mean I am not using frameworks—one does not rule out the other.

Comments

  1. How to count the number of characters in a multi-byte string using PHP.
  2. Learn what PHP objects are, and how to use them in your own PHP coding adventures.
  3. Why the caret character is not working in exponential growth calculations in PHP, and what to use instead.
  4. Tutorial showing how to check if a variable is a number in PHP

More in: PHP Tutorials