These 5 PHP challenges cover many critical aspects of web development. If you are struggling to progress with your learning, want to refresh your skills, or want some guidance, this is the perfect list for you. After completing these projects you can create almost anything you want online, including social networks, custom forum and blog software, and much, much more. These 5 development ideas will help you go from a beginner with PHP to an advanced programmer in no time. I assure you that mastering these aspects of PHP will help you not only create whatever you want, but sell your web software too. So, what are you waiting for? It’s time to learn!
Assuming you know at least some basic PHP, this should come easy, but for those of you who do not know any PHP you can learn about loops & arrays, or follow my basic PHP tutorial to learn about strings, variables, and more.
Besides avoiding these 8 common programming mistakes, here is a list of skills you should already know or learn before starting on any of our 5 PHP skills in this article!
- Variables, strings, and integers
- Arrays & objects
- For / foreach / while / etc loops
- Basic data checks (isset, is_array, in_array, etc)
- Comparison & value operators (==, ===, !=, !==, >, <, =>, <=)
- Boolean values (true, false)
- Functions and/or PHP classes
Forms & User Data
HTML forms are perfect for accepting user input and are common in PHP because they are used for registration and login pages, or more complicated features like blog articles. The most common use of PHP is accepting information from a user’s form entries, validating that the data is accepted, and saving the information to a database or file. It’s the perfect use case to master for people starting to learn PHP. Regardless of your storage methods, you will learn about the $_POST and $_GET (not as common) arrays that are sent to your PHP script from the form. You can spend some time learning about FILTER_VAR() and other various ways to validate or sanitize user input. It’s important to master that last step to protect your websites from exploits and vulnerabilities such as XSS or SQL injections.
Want to create something while you learn about PHP form handling? Here are some ideas:
- Display a sentence on the page such as “Hey, William – we see you are 26 years old, living in the USA and you said you love coding“
- Set up an if-else statement and response (ex: Check if user is over 18 or 21 by comparing today’s date and their birthday)
- Check if an email is in the proper format
You can go the extra mile by learning about the PHP $_FILES array which accompanies the $_POST array when a user attempts to upload a file.
Storing & Modifying Information
Although using a database is best practice for storing information, you can also save files to your server to save your data. One of the very first projects I worked on as a PHP beginner used the fwrite() PHP function to generate files that kept JSON data inside them. This data was responsible for storing page titles, descriptions, image URLs, and more. It wasn’t efficient, but it was an excellent learning experience. The downside of this method was that it was very difficult to search for pages because each page had its information stored in a separate file.
For databases, you will need to know some basic SQL so you can INSERT, SELECT, UPDATE, and DELETE data. If you need help, you can follow my beginner SQL tutorial or look online for other guides. In addition, you will need to learn one of PHP’s various methods for connecting to a database and accessing the information inside. I recommend prepared statements for this. If this is all new to you, I highly recommend learning a bit about basic database design. I recommend beginning with a MySQL database that has one table with a primary key, one simple VARCHAR column field, and one more column to store an integer. This will cover many use cases for a database such as storing a name and an age, or using a number to assign the content to a user ID.
Unless you plan on manually modifying each page on your website whenever there is an update, you can benefit from a database or file storage by using HTML templates to display your data consistently and quickly.
To become a master with PHP, we recommend trying the following…
- Generating a new file or folder
- Checking if a file or folder exists
- Randomizing a file name to ensure uniqueness
- Checking file size, type, etc to maintain a secure server
- Create a database & user
- Set up a PHP file for database connection
- Insert, select, update, and delete data in database
- Validate & sanitize data before adding to a database or file
Account Registration & Login
Once you are able to accept basic form data and save it to a database or file, it’s time to learn about PHP sessions. Using the $_SESSION array, you can keep people logged into their account securely and allow them to upload files, add or modify their own content, and view other members-only pages.
You simply need one HTML form to accept the desired username, perhaps their email address, and their password. You can make this more advanced by using a confirm password field, making sure the email is not already in use and is a valid email, and also by ensuring the username is not taken. Additionally, you could use some default PHP functions to force data to follow standards such as minimum or maximum length, symbol/number/capitalization requirements, and more. At the very least, save this information to your database and use the default password_hash() function to help your users stay secure.
You will also need a login form. When they try to login you can search your database for a username or email match, and use the password_verify() function to make sure they’ve logged in correctly. Once this is done you can begin by setting your first session variable to keep track of the logged in user across your website.
Here are some things you can start planning or building once you master account processes and sessions.
- Create a secure PHP dashboard (ex: your customers can view private videos, articles, or content you produce)
- The start of a custom forum, blog, or social network
- Invite only / secret communities
- Chatroom or private messaging
While there is a default mail() function, you will quickly find that it is easier to use a library such as PHPMailer. You may also discover that your emails are going to spam, so you must ensure your server is set up correctly to avoid this occurring on major providers such as Gmail.
Mailing in PHP may seem complicated at first, but once you learn about mail headers, subjects and messages, you can try your hand at CC/BCC options or even full on HTML email templates. You will use mailing in a variety of projects to create notification features, email / account verification protocols, and anything else that needs to be sent out.
Here are the most common purposes for emailing users…
- Email verification & anti-spam measures
- Account recovery & password reset tools
- Newsletters and instantly sharing content
- System notifications / alerts / event reminders
It is used in popular services such as Twilio, PayPal, Stripe, Google, and much more. You can use JSON to provide or receive data with payment processors, advanced mapping APIs, and any other service that offers this protocol for connecting.
Once you master JSON interpreting and output, you can develop features with….
- News & content aggregation / sharing (I initially started with finding art on Reddit to display on my site)
- Cryptocurrencies, PayPal, debit/credit card online payments and subscriptions
- SMS / text message & call sending or receiving
- Two factor authentication, anti-spam CAPTCHA, and more
- Established companies or services to power your website
Creating Custom Software
The most important thing about creating custom software online is making sure your code is secure. However, you can also focus on speed and other optimizations, or just creating unique features. Whether it’s a plugin for your favorite forum or blog software, or a simple tool for personal use, all of the skills in this article will help you achieve your goals. Although these may seem challenging, taking it one step at a time will help you significantly. As the Chief Operating Officer at Wubur and long time programmer, I am constantly learning new skills. I spend my time researching and creating new libraries, mastering the art of efficiency, and building custom web portals and tools for businesses across the globe. I promise you that if you can honestly say you can create everything in this article from scratch, you will be able to land a job as a PHP developer, create your own web systems, and make money online as a freelancer. So, don’t be intimidated – be inspired, work hard, learn more, and I assure you that you will reap the benefits.