Free online course PHP for Beginners: Learn PHP, MySQL, MVC, Routing, Authentication and Testing
Duration of the online course: 10 hours and 45 minutes
New
Build real PHP skills fast in this free online course: MySQL, MVC, routing, auth, validation, sessions, and testing—plus a certificate-ready foundation.
In this free course, learn about
How to choose a first programming language based on goals/context rather than trends
Set up a PHP dev environment: editor, PHP runtime, built-in server, and basic workflow
Password best practices: hash on save and verify via hashing API, never plain comparisons
Composer workflow: PSR-4 autoload, dev dependencies, and Pest testing (unit vs feature)
About the free online course
Start building dynamic websites with PHP by learning the parts that matter when you move beyond hello world. This course is designed for beginners who want practical skills in modern web development, combining clear fundamentals with the patterns you will see in real applications. You will go from writing your first PHP tags and working with variables, conditionals, arrays, and functions to organizing your code so it stays readable as your project grows.
As you progress, you will shift from simple scripts to building structured pages with reusable templates, partials, and clean separation between logic and presentation. You will understand how URLs map to code by creating your own routing, handling different request methods, and following resourceful conventions that keep your project consistent. Along the way, you will learn why small architectural choices like a public document root, autoloading, and namespacing can dramatically improve maintainability.
Database work is treated as a core skill, not an afterthought. You will connect PHP to MySQL using PDO, encapsulate database access in a dedicated class, and learn how configuration and environments help your code adapt safely across machines. You will also build a strong security mindset, using prepared statements to prevent SQL injection and escaping untrusted output to protect users.
User accounts turn your app into a real product, so you will implement sessions, registration, login and logout, secure password handling, authorization rules, and middleware to guard routes appropriately. Form handling is approached with care, emphasizing server-side validation, clearer error handling, and patterns like Post/Redirect/Get to deliver a smoother user experience.
Finally, you will get an approachable introduction to automated testing with Composer tooling and Pest, so you can refactor with confidence and start developing professional habits. By the end, you will have a solid foundation to continue into larger PHP frameworks and real-world backend work.
Course content
Video class: How to Choose A First Programming Language01m
Exercise: What is the main factor suggested for choosing your first programming language?
Video class: PHP For Beginners, Ep 2 - Tools of the Trade08m
Exercise: Which set of tools is identified as the basic setup needed before starting to build PHP applications?
Video class: PHP For Beginners, Ep 3 - Your First PHP Tag08m
Exercise: Which command starts PHP’s built-in development server at localhost on port 8888?
Video class: PHP For Beginners, Ep 4 - Variables07m
Video class: PHP For Beginners, Ep 5 - Conditionals and Booleans11m
Exercise: In PHP, why can an undefined variable warning occur when setting a variable inside an if block?
Video class: PHP For Beginners, Ep 6 - Arrays08m
Exercise: In PHP, what is the best data structure to store a collection of book titles so you can loop through them?
Video class: PHP For Beginners, Ep 7 - Associative Arrays07m
Exercise: When looping over an array of books where each book is an associative array, how do you output the book's title?
Video class: PHP For Beginners, Ep 8 - Functions and Filtering12m
Exercise: When filtering books by author in PHP, which operator should be used to check equality (not assign a value)?
Video class: PHP For Beginners, Ep 9 - Lambda Functions12m
Exercise: What PHP built-in function can replace a custom loop-based filter when you want to filter an array using a callback?
Video class: PHP For Beginners, Ep 10 - Separate PHP Logic From the Template08m
Exercise: What is the primary benefit of moving PHP logic into one file and the HTML view/template into another?
Video class: PHP For Beginners, Ep 11 - Technical Check-In (With Quiz)04m
Exercise: In PHP, how do you access a value from an associative array like $business using a key such as "name"?
Video class: PHP For Beginners, Ep 12 - Page Links11m
Exercise: When using PHP’s built-in server, what happens if you request a URL it can’t match to a file (e.g., /about without an about route/file)?
Video class: PHP For Beginners, Ep 13 - Partials09m
Exercise: How can you make the banner text in a shared PHP partial change per page without duplicating the banner HTML?
Video class: PHP For Beginners, Ep 14 - Superglobals and Current Page Styling12m
Exercise: Which approach is used to conditionally apply an active CSS class to a navigation link based on the current page?
Video class: PHP For Beginners, Ep 15 - Make a PHP Router18m
Exercise: When building a simple custom router, which PHP function is used to extract only the path (excluding the query string) from the current request URI?
Video class: PHP For Beginners, Ep 16 - Create a MySQL Database06m
Exercise: When creating the database connection, which host and port are used as the defaults to connect locally?
Video class: PHP For Beginners, Ep 17 - PDO First Steps14m
Exercise: After preparing a SQL query with PDO in PHP, which method actually sends the prepared statement to MySQL to run it?
Video class: PHP For Beginners, Ep 18 - Extract a PHP Database Class10m
Exercise: Why is the PDO connection created in the __construct() method of a Database class?
Video class: PHP For Beginners, Ep 19 - Environments and Configuration Flexibility13m
Exercise: What is the main reason to move database connection settings (host, port, dbname, username, password) into a separate configuration file?
Video class: PHP For Beginners, Ep 20 - SQL Injection Vulnerabilities Explained10m
Exercise: What is the safest way to use a query-string value like id in a SQL query to prevent SQL injection?
Video class: PHP For Beginners, Ep 21 - Mini-Project: Notes App07m
Exercise: What is the main purpose of adding a foreign key constraint from notes.user_id to users.id?
Video class: PHP For Beginners, Ep 22 - Render the Notes and Note Page14m
Exercise: When loading a single note by its ID, which database fetch method should be used instead of fetching all results?
Video class: PHP For Beginners, Ep 23 - Introduction to Authorization14m
Exercise: When a note exists in the database but was created by a different user, which HTTP status code should be returned?
Video class: PHP For Beginners, Ep 24 - Programming is Rewriting12m
Exercise: What is the main purpose of adding a findOrFail method to the Database class?
Video class: PHP For Beginners, Ep 25 - Intro to Forms and Request Methods18m
Exercise: When submitting a form in PHP, what is the key difference between a GET request and a POST request in how the form data is sent?
Video class: PHP For Beginners, Ep 26 - Always Escape Untrusted Input08m
Exercise: Which PHP function is used to escape user-provided note content when displaying it to prevent injected HTML/JavaScript from executing?
Video class: PHP For Beginners, Ep 27 - Introduction to Form Validation12m
Exercise: Why is adding the HTML required attribute to a form field not enough to prevent empty data from being saved?
Video class: PHP For Beginners, Ep 28 - Extract a Simple Validation Class11m
Exercise: Why can the validation method be made static in the Validator class?
Video class: PHP For Beginners, Ep 29 - Resourceful Naming Conventions06m
Exercise: Which controller naming convention is used after reorganizing note-related controllers into a notes directory?
Video class: PHP For Beginners, Ep 30 - Autoloading and Extraction19m
Exercise: Why is it recommended to change the document root to a "public" folder when using PHP’s built-in server?
Video class: PHP For Beginners, Ep 31 - Namespacing: What, Why, How12m
Exercise: In PHP, after adding `namespace Core;` to a class like `Database`, what is a clean way to reference it in another file without typing the full namespace every time?
Video class: PHP For Beginners, Ep 32 - Handle Multiple Request Methods From a Controller Action?12m
Exercise: Why is a standard anchor tag (GET request) not appropriate for deleting a note?
Video class: PHP For Beginners, Ep 33 - Build a Better PHP Router20m
Exercise: How can a form submission simulate a DELETE request when HTML forms only support GET and POST?
Video class: PHP For Beginners, Ep 34 - One Request, One Controller07m
Exercise: When following common RESTful conventions, which controller action name is typically used to handle saving a newly created note (via a POST request)?
Video class: PHP For Beginners, Ep 35 - Make Your First Service Container19m
Exercise: In a simple service container, what does calling resolve do?
Video class: PHP For Beginners, Ep 36 - Updating a Resource With PATCH Requests21m
Exercise: When submitting an edit form to update an existing note using RESTful conventions, which HTTP method should be used?
Video class: PHP For Beginners, Ep 37 - Sessions 10113m
Exercise: What must you do before you can read from or write to the $_SESSION superglobal in PHP?
Video class: PHP For Beginners, Ep 38 - Register a New User19m
Exercise: After successfully creating a new user account, what is the practical use of sessions demonstrated?
Video class: PHP For Beginners, Ep 39 - Write Your First Middleware22m
Exercise: Why must the router's HTTP verb methods (like GET/POST) return the router instance when adding route middleware with chaining (e.g., ->only('guest'))?
Video class: PHP For Beginners, Ep 40 - Manage Passwords Like This For The Remainder of Your Career04m
Exercise: When saving a new user's password during registration, what is the correct secure approach in PHP?
Video class: PHP For Beginners, Ep 41 - Log In and Log Out25m
Exercise: When verifying a login attempt, why can’t you directly compare the submitted password to the password stored in the database?
Video class: PHP For Beginners, Ep 42 - Extract a Form Validation Object13m
Exercise: When refactoring login validation into a dedicated class, which approach best matches the intended responsibility of the form's validate method?
Video class: PHP For Beginners, Ep 43 - Extract an Authenticator Class13m
Exercise: Why should the controller (not the authenticator class) handle redirects and returning the login view?
Video class: PHP For Beginners, Ep 44 - The PRG Pattern (and Session Flashing)21m
Exercise: What does the Post/Redirect/Get (PRG) pattern help prevent after a failed form submission?
Video class: PHP For Beginners, Ep 45 - Flash Old Form Data to the Session05m
Exercise: When using the Post/Redirect/Get pattern, how can you repopulate a form field (like email) after a failed login attempt?
Video class: PHP For Beginners, Ep 46 - Automatically Redirect Back Upon Failed Validation26m
Exercise: What is a key benefit of throwing a custom ValidationException during form validation?
Video class: PHP For Beginners, Ep 47 - Composer and Free Autoloading13m
Exercise: After defining PSR-4 mappings in composer.json, what is the next required step to make Composer autoloading work in your app?
Video class: PHP For Beginners, Ep 48 - Install Two Composer Packages: Collections and PestPHP15m
Exercise: When installing an automated testing tool with Composer, where should it typically be listed in composer.json?
Video class: PHP For Beginners, Ep 49 - testing approach tdd and pest 2160p18m
Exercise: In Pest, what is the main difference between a unit test and a feature test?
Video class: PHP For Beginners, Ep 50 - The Next Step in Your Php Journey16m
Exercise: In a new Laravel project, where are the web routes typically defined?