Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

The PHP Practitioner

We all start somewhere. When it comes to web development with PHP, well, your first stop is this series. Designed specifically and exclusively for beginners, here, you'll learn the fundamentals of PHP - all the way down to defining variables and arrays.

If you feel somewhat unprepared for the content at Laracasts, this "PHP for beginners" series should be your next stop. New lessons are published every Thursday, so don't fall behind!

Updated Series Available

You are viewing an archived course. We instead recommend that you watch PHP For Beginners.

Progress

Series Info

Episodes
25
Run Time
4h 46m
Difficulty
Beginner
Last Updated
Oct 4, 2016
Version
Latest

Series Episodes

  1. Episodes (25)
    1. Step 1: Get PHP Installed

      So you've decided to become a web developer? Excellent, excellent choice. At this point, you have a basic understanding of HTML and CSS, and are now ready to take the next step. Right? Great! Let's learn PHP from the ground up.
    2. Step 2: Install a Proper Code Editor

      Before we get started, let's ensure that you have a proper code editor installed on your machine. As you'll find, code editors are much like fashion: everyone has their own preference. It doesn't matter which you choose, so pick one!
    3. Step 3: Variables

      Now that you're ready to begin coding, let's start at the top. What exactly is a variable, and why would you ever use or need one?
    4. Step 4: PHP and HTML

      PHP is a language built for the web. As such, it mixes with regular HTML beautifully. Let's learn how that all works in this episode. You'll review embedding PHP in HTML, calling your first function, and fetching URL parameters.
    5. Step 5: Separate PHP Logic From Presentation

      Step 5 Homework: Play around with creating a new file, preparing a few variables, and then loading a separate "view" file to present the HTML.
    6. Step 6: Understanding Arrays

      Let's learn about a new construct: arrays. Think of them as primitive collections of related data. Maybe you have an array of names, or animals, or practically anything. Even better, we can filter through this data and act upon it with ease.
    7. Step 7: Associative Arrays

      We've learned about basic arrays, but you may also creative associative arrays when necessary. The only difference is that each value within the array is associated with a key. Let me show you.
    8. Step 8: Booleans

      "Boolean" is a scary, but simple term to understand. It's a data type that represents one of two values: true or false. As you'll find, you'll reference booleans constantly within your projects. So it's important that you understand this one.
    9. Step 9: Conditionals

      A conditional is how we branch our logic into different paths. "If some value is true, then we want to proceed in this way. Otherwise, let's handle it in that way." As you can see, booleans and conditionals go hand-in-hand.
    10. Step 10: Functions

      Think of a function as a container for reusable pieces of logic. In this lesson, you'll create your very first function.
    11. MySQL 101

      You've only just begun learning the fundamentals of PHP, and already I'm throwing something else at you. Sorry (bows head in shame), that's just how it is; there are lots of moving pieces to your typical web application. We must take some to review databases. This is how we "remember" information. Or, in other words, if a user creates a handful of todo items, how will we remember those todos for when they return to our site next week? Well, the answer is through a database.
    12. Classes 101

      I know you're excited about MySQL, and want to fetch records using PHP. However, we need to make one quick pit stop. We must learn the basics of writing classes, and creating objects. So let's tackle that in this episode, and then I promise we'll move on to writing SQL queries with PHP.
    13. Intro to PDO

      Now that you understand what a class is, we can get back to fetching your first results from the database. To do so, we'll leverage PHP's PDO library, and create a prepared statement.
    14. PDO Refactoring and Collaborators

      In this episode, you'll perform your first refactor. "Refactor" is a term we use to describe the process of changing the structure of your code, without affecting the underlying behavior. I'll be pushing your limits a bit in this episode, so you may need to watch this one twice. As always, ask any questions you mind have in the comments below.
    15. Hide Your Secret Passwords

      At the moment, we're hardcoding our database username and password directly within the Connection class. But, we don't really want to do this. It's too dangerous. Instead, let's extract any secret passwords or keys for our app into its own file, and then lock that down.
    16. Make a Router

      Let's discuss routing in this episode. While, yes, you can create PHP files that correspond to the URI, this breaks down pretty quickly. So instead, we'll make a very basic router. This allows us to associate any URI endpoint with a controller.
    17. Dry Up Your Views

      Let's take some time to work on our views. At the moment, we've been rewriting the entire wrapping HTML for every single page. Naturally, this breaks down very quickly in real life. Each time you update, say, your navigation area, you'd need to open several different view files to make the change. No thanks. Instead, let's review the first step to drying up your templates.
    18. Array Filtering

      PHP's various array functions are tools that absolutely need to rest in your belt. While the good ole'foreach can usually get the job done, more often than not, there's a better way. In this episode, I'll introduce you to array_filter, array_map, and array_column.
    19. Forms, Request Types, and Routing

      Let's transition over to working with forms. If we want a form's submission to POST to a particular endpoint, well, our router isn't yet set up to handle that. How exactly might we associate a URI with the request type (GET, POST) that it should respond to? In this episode, we'll do a bit of refactoring for this very thing!
    20. Dynamic Inserts With PDO

      So far, we've only written the logic to fetch records from the database. But now it seems that we need to, not only insert new records, but do so dynamically. It sounds like we'll need to update our QueryBuilder class to allow for this.
    21. Your First DI Container

      "Dependency injection Container" sounds like a super scary thing. But it's easy to understand! Think of them as boxes. Apply a label, and throw your stuff into the box. When you need them back, simply look for the corresponding label! In this episode, we'll transition from our simplistic $app array, to a dedicated DI container.
    22. Refactoring to Controller Classes

      So far in this series, our "controllers" have simply been plain PHP files. In this episode, however, we'll refactor the router to allow for loading and calling actions on a controller class. I think you'll find that this drastically simplifies our workflow.
    23. Switch to Namespaces

      At the moment, all of our classes share the same global namespace. But, think about it: you wouldn't throw your entire music collection into a single folder, and the same is true for your PHP classes. In this lesson, we'll switch over to dedicated namespaces, while discussing the benefits to doing so.
    24. Meet Your Batteries Included Framework: Laravel

      It's time for you to meet my framework of choice: Laravel (duh). In this lesson, we'll review the basic folder structure, discuss how it is similar to the custom-built framework from this series, and then review why it's preferred, in this author's opinion, to choose a battle-tested solution like Laravel over manually wiring things together.

Continue Learning