This Cyber Monday Envato Tuts+ courses will be reduced to just $3. Don't miss out.
Learning something from scratch is almost always an arduous affair -- you simply have no idea as to where to start, or not to start, to kick things off. I loathed learning about the idiosyncrasies of C++'s syntax when all I wanted to learn were some darn programming concepts. As I'm sure you can agree, this is a less than ideal situation.
This is where the Nettuts+ "The Best Way to Learn" series comes into the picture. This series is intended to be your blueprint, your road map, your plan of action for learning your topic of choice! You don't have to worry about finding the best resources, sorting out the bad ones, and figuring out what to learn next. It's all here. Just follow it, step by step.
Today, we're going to figure out the best way to learn PHP.
Assignment #1: Disregard the Naysayers
If you're reading this, chances are that you've Googled a lot to decide which language to learn and how. And without a doubt, you must have run into a ton of articles about how language X is so much better than PHP - and PHP is going to die through obscurity soon.
Haters gonna hate!
As the popular saying goes, haters gonna hate! PHP has been at the helm of the web as you know it and that's for a very good reason. It's a mature language, has excellent documentation and a massive number of learning resources along with a great variety of utilities built around it.
And let's not forget the sheer proliferation of hosts and frameworks PHP has spawned. Like Heroku like hosting? Don't worry, there are a number of excellent options for PHP as well!
Assignment #2: Install PHP through [X]AMP
You could just install PHP but it gets quite boring without a server and some sort of database to play around with. And as a beginner, it's not really trivial work to get all of these installed and configure each to work with the others without issue.
This is where you grab a package such as XAMPP. These life savers typically install Apache, your web server, along with mySQL, a database system along with PHP significantly cutting down on set up time.
Bonus points if you're the code monkey type and install everything by hand.
Assignment #3: Learn the Fundamentals
Before I send you off to alternate sources for PHP enlightenment, let me first refer you to our very own series for absolute beginners from none other than your favorite editor, Jeffrey Way.
In this series, over the course of 40+ screencasts, everything from installing PHP to variables, from functions to working with MySQL is covered.
You won't find a better introduction to the PHP language than this series, and, while it's unfortunately not free, you can subscribe to Tuts+ Premium for a mere $19. It's absolutely worth it!
Assignment #4: Sign up with Khan Academy and Lynda
Khan Academy may sound like an odd choice since there are no PHP lessons in there but trust me, it's a good choice. What you can't find in pure PHP, you can find in the basic of programming. For example, if you're new to the entire programming hoopla, this is a great place to start.
Another great place to start is Lynda. Here at Envato we have immense respect for those teaching there -- the content is usually top notch and cover their topics well. And they cover a vast range of topics as well. If you need a specific lesson, this is where you should begin.
Assignment #5: Read a Few, Good Books
The videos should give you an very good springboard, but, hopefully, hungry for more knowledge. The below books should give you a more elaborate introduction and lots of varied topics for you to devour.
If you feel bored reading the initial portions, good, just skip ahead to the portions where your head hurts.
Author: David Powers
“So why another PHP book? Well, not everyone who uses PHP is a programmer. PHP is the most common dynamic web language used by designers, if their web sites require dynamic functionality, and there are hordes of novice users who want to set up dynamic web sites.”
Author: Jason Lengstorf
“PHP for Absolute Beginners starts at the very beginning stages of web programming, showing even the most inexperienced web developer, through examples, how to build a basic content management system. The book dives directly into writing web applications with accompanying explanation rather than explaining elements of the language and then showing examples.”
Author: Adam Trachtenberg
“PHP Cookbook has a wealth of solutions for problems that you’ll face regularly. With topics that range from beginner questions to advanced web programming techniques, this guide contains practical examples — or “recipes” — for anyone who uses this scripting language to generate dynamic web content.”
Assignment #6: Create Something Simple
This is the perfect time to build something simple with your new found knowledge.
Alright! With all those information swirling inside, you should feel like a rockstar. If not, don't worry, it's completely normal. Talk to me later so we can share notes about how daft we feel.
This is the perfect time to try and build something simple with your new found knowledge. It's best to not try to build something too complicated and fail though -- it's a lot more disheartening than you'd think. Imagine being rejected for the first time. Now multiply it by a few hundred and you'll be close.
Since you're just starting out, play it safe and build something absolutely basic like a CRUD app. Nothing major -- a few inputs and an 'uncool' table to display saved results. This tiny exercise will test your knowledge of a lot of PHP basics including the much vaunted 'interfacing with a database' skill.
Assignment #7: Create Something a Little More Complicated
Feeling better now? You should! You gazed upon where there was naught and said 'This won't do!' and created something from scratch. If it were me, I'd be pumped. Let's use it to extend our knowledge a little more.
While a simple CRUD app is a great start, you'd ideally need more complicated. A simple login/user system is absolutely great for this.
You get to learn how sessions work, how basic authentication is done, how to implement basic security measure and a ton more.
Note: If you're in need of a little guidance, start here.
Assignment #8: Try out a Lean, Lightweight Framework
At this point, after creating a non-trivial system, you probably have noticed how repetitive some of the work is. Why the heck do you need to write your own sessions class or work on hashing passwords yourself? The answer, my friends, is to go with a lightweight framework.
A framework abstracts a lot of the repetitive, boilerplate features in your typical application thus freeing up your brain to actually getting things done.
Note: Not to toot our own horn but we have an immensely thorough session that covers almost all of the important parts of CodeIgnier, a very lightweight, yet powerful framework. If you prefer Kohana, we do that too!
Assignment #9: Try out a Full Stack Framework
Now that you've been with a lightweight framework, you can now check out the alternate path -- a full stack framework. A full stack framework typically ships with a lot more features including code generators, ORMs and an inbuilt server. An excellent choice would be CakePHP -- the PHP equivalent of Rails.
The reason you need to check these out later is because there is a lot of 'magic' going on. Without a solid understanding of how lightweight frameworks work, it's hard to really dig into the better featured ones since you'll mostly be lost and won't understand how things work.
- Getting Started With the FuelPHP Framework
- Build an Admin Panel With FuelPHP
- Easy Form Validation in FuelPHP
- Build Web Apps From Scratch: Introduction
- Build Web Apps From Scratch: Eloquent
- Build Web Apps From Scratch: Filters, Validations, and Files
Assignment #10: Build Something Awesome
With all that information behind you, giving you Indiana's swagger, now is the time to build something truly awesome. This is the final destination for PHP nirvana -- and the choice is up to you.
So what exactly should you be building? Here are a few ideas:
- A blog is always a safe option. There are a ton of open source solutions for you to get inspiration for the software architecture and the functionality requirements are unambiguous.
- It's a little old school but a discussion board is another excellent choice. Moderator rights and post counts, ahoy! If you need a little guidance, this tutorial is a great place to start.
- Or if you're too hip for any of these, build yourself a project management application or even just a todo list. They're always fun to build and you'll almost always end up using it personally.
Of course, there are just suggestions. No one is stopping you from building a multi-user, realtime chatroom or a service which receives input from random internet strangers and lights up stuff in your room. No one's judging, go crazy!
Assignment #11: Advance into Development Eliteness
Development is as much about the workflow as much as it is about the code.
Development is as much about the workflow as much as it is about the code. Recently, a typical developer's workflow has been massively improved by version control as well as platform as a service solutions.
Version control, as expected, frees you up from having to manage revisions manually while PaaS solutions save you from having to do a lot of sys admin work just to get your app to scale.
Resources for the latter are a bit hard to find but here is an excellent screencast on getting started with Git.
Assignment #12: Get Involved and Be Up to Date
New techniques and tools are being introduced everyday.
The web development industry is rarely in a state of equilibrium -- everything is changing all the time. New techniques and tools are being introduced everyday and it's important that you not only read about them but also start contributing.
Find a little glitch in some framework? Submit a patch. Added some new functionality? Patch away! These not only earn you good karma but also valuable points on your resume.
Assignment #13: Keep an Open Mind and Explore
Even though that you are a master of the PHP domain, you can't afford to, or shouldn't, rest. PHP is a grand language but that doesn't mean that it does absolutely everything perfectly.
There is an ever increasing number of new languages out there each adding their own spin to solving a very specific problem that you simply can't afford to miss out on. And learning something new something doesn't really wipe out knowledge gained earlier does it? Well, except Star Wars, of course. Those new movies were a crapshoot.
Ruby, Python and Clojure are some of the languages that I'm constantly amazed by and I think they deserve your attention as well. Neither of these languages are necessarily 'better' than PHP but each of them do things their own unique way and you owe yourself a chance to take a look and find out whether that approach is for you. While we're a bit low on Clojure related content, we do have excellent tutorials on Ruby and Python right here.
Well, this is the end of the road, partner! Hopefully, this plan can help you become a PHP master and, indeed, take over the world.
If you feel that I'm missing some obvious resources here, feel free to yell at me in the comments section below and I'll update this article whilst crying silently. Thank you so much for reading!