Last Updated: September 09, 2019
·
3.381K
· erikaheidi

Advices and resources for PHP novices

Picture

Yesterday, a tweet from Chris Cornutt made me think a lot about how it is nowadays to get started, from the very beginning, with PHP.

It's easy to forget that there's a lot of people out there coming new to PHP every day that need guidance and help for the basics. Chris Cornutt

This post is a collection of things that I consider important for people who are starting with PHP, based on my experiences with this language through the years.

PHP has considerable evolved in the last years, thanks mainly to the community efforts. Comparing to the early days, we have a much more strong language and an amazing community. As a downside for the language evolution, as things change, tutorials and practices might get deprecated. So we have a lack of good updated tutorials for beginners.

Another thing to notice is the framework explosion - Symfony and Zend, for instance, are widely known and figure as a common requirement for job opportunities. There's nothing wrong with frameworks, but they are not really beginner-friendly in my opinion. That leads to my first advice:

Learn the language, not a framework

Keep it simple for learning, try to write your own pieces of code, think about something funny to write and practice your PHP skills. Experiment. Don't start tied to a framework, because then you will be dependent on it, and you will probably not understand how it works behind the scenes.

I'm not condemning the use of frameworks whatsoever, because they help a LOT and you are not supposed to reinvent the wheel. But to really learn a language, you need to study the language itself, that way you will be able to understand any framework you come across.

If you don't have a previous background on programming languages, you should definitely study some theory regarding Object Oriented Programming and [Design Patterns](http://en.wikipedia.org/wiki/Design_patterns_(computer_science). This will really help you to write good code.

And one more really important thing: have a look at PHP - The Right Way. You will find excellent explanations about the best practices in PHP and guidelines for a clean and readable code. This website is a must-have in your bookmarks.

Composer

The next thing you need to study is Composer, no doubt about that. Composer is a dependency manager for PHP, and I honestly think that we can separate PHP history in before / after Composer. With a simple JSON file you define your project dependencies, and running composer install will download the right versions of the libraries you need, directly from their repositories. Maintaining your project dependencies up-to-date was never so easy.

Git and Github

[Git](http://en.wikipedia.org/wiki/Git_(software) is turning into the default for distributed version control and source code management in modern projects. It was created by Linus Torvalds and popularized by Github, the most amazing space for collaborative coding, either open source or not.

The Frameworks

Now that you know the important stuff and have a good basement, its a good moment to try some frameworks. To have a better understanding on how the frameworks are built, its strongly recommended that you study the MVC architecture pattern - thanks @vipulbhatia99 for suggesting this additional note.

Starting with a microframework, like Silex, is a good way to go. It is based on Symfony 2, so you will have a good idea about how Symfony works, but without the heavy load and tight specs.

Get Involved

To get more expertise and get acquainted with new libraries and frameworks, the best thing to do in my opinion is contributing to open source projects. There are a lot of PHP open source projects on Github waiting for your contribution, it doesn't need to be huge, every help counts.

Also, try to get in touch with other developers, user groups are amazing for that. IRC (Freenode) is also a great alternative to communicate with other PHP developers around the world and get some help - try the channel ##php for starting.

Hope this may help someone getting started with the language that I embraced :) <3 <3

Summary

  1. Start simple
  2. Learn the language, not a framework
  3. Use PHP - The right way as a reference for good PHP practices
  4. Study the Tools - Composer, Git
  5. Have a look at the frameworks and pick one, start simple
  6. Get Involved in Open Source projects and with the PHP community

5 Responses
Add your response

100% agree. Besides "Learn the language, not a framework" I'd like to add "Learn to code, no matter the language". Programming language are just tools and the way of mastering those tools are usually the same. The SOLID principles, for example, will help us to solve problems effectively. Also this knowledge will be usefull not only with one language. For example if we've got good SOLID skills we can switch from PHP to Java without more problems than the learning of the the new syntax. Don't reduce the learning of one language to books and tutorials of this programming language.

But IMHO there's something that I you miss: "Read another's code". Pick open source projects and read its code. There're great projects: Symfony, Doctrine, Laravel,... Get into internals and understand the way that they use to solve the problems, detect the patterns. This simple action will "infect" your mind with good practises that you'll use later whiting your projects.

over 1 year ago ·

Hi Gonzalo, thanks for you comment! I agree with you, specially the "Learn to code" part, this is really important since its quite common we need to use other languages from time to time for solving different issues, and that's what "builds" a good programmer.

I also agree about the "read another code" part, but I think it can be hard for a beginner to understand the principles behind these projects. But yes, of course, after you have some good basement it is extremely useful to read and study well-known good code, which leads us to these amazing projects =)

thanks again for you contribution!

over 1 year ago ·

Learn the language, not a framework

A must! Most newcomers dive straight into frameworks even if they don't know OOP.

over 1 year ago ·

learning the language is a must. algorithms too!!
people tend to make mistakes that become very costly if these are not followed

over 1 year ago ·

And: Beginners should also accept the fact that coding is a high-tech thing and it takes years to really learn it. Lots of people start coding on the weekend and expect to be able to build business-level applications within weeks. My advice is: Relax, take things easy, and hire a professional if you really need something quite fast. If you want to learn it, take your time, take things easy and don't get frustrated. Coding can be a pain in the s in the beginning, especially for self-learners. Don't pressure yourself, do it more for fun than for results in the beginning.

over 1 year ago ·