Free Course Image PHP for Beginners: Learn PHP, MySQL, MVC, Routing, Authentication and Testing

Free online coursePHP for Beginners: Learn PHP, MySQL, MVC, Routing, Authentication and Testing

Duration of the online course: 10 hours and 45 minutes

New

Free Laracasts course to learn PHP, MySQL, routing, MVC structure, authentication, security basics, Composer, and testing with Pest.

In this free course, learn about

  • Getting Started with Programming and PHP
  • PHP Fundamentals: Variables, Conditionals, Arrays, and Functions
  • Separation of Concerns and Page Structure
  • Routing Fundamentals
  • Databases with MySQL and PDO
  • Building the Notes App: Data, Views, and Authorization
  • Forms, Validation, and Input Safety
  • Project Structure, Autoloading, and Namespacing
  • RESTful Routing, Controllers, and the Service Container
  • Sessions and Authentication
  • Validation Refactoring and UX Patterns
  • Composer, Packages, and Testing
  • Next Steps with Laravel

Course Description

PHP for Beginners is a free web development course from Laracasts designed to take you from first principles to building real, secure, database-driven applications. It starts with the fundamentals of the language and the workflow you need to be productive, then quickly moves into writing clean PHP that separates logic from presentation for maintainable code.

As you progress, you will learn how to think in requests and responses, create your own routing system, and structure an application using clear conventions. You will connect PHP to MySQL using PDO, extract reusable classes, and manage configuration for different environments. Along the way, you will explore essential security practices, including understanding SQL injection risks and safely handling untrusted input.

The course also introduces practical application building through a small notes project, helping you move from isolated syntax to full features. You will work with forms, validation, resourceful patterns, controllers, and middleware, then expand into sessions, user registration, login, and logout. Password handling and authorization concepts are covered with a focus on habits that scale beyond beginner projects.

To round out the journey, you will learn modern PHP tooling such as Composer, autoloading, and namespacing, and you will be introduced to automated testing with a TDD mindset using Pest. If you want a structured, hands-on path into PHP, MySQL, MVC-style organization, routing, authentication, and testing, this course offers a complete starting point for building confident backend skills.

Course content

  • Video class: How to Choose A First Programming Language 01m
  • Exercise: What is the main factor suggested for choosing your first programming language?
  • Video class: PHP For Beginners, Ep 2 - Tools of the Trade 08m
  • 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 Tag 08m
  • Exercise: Which command starts PHP’s built-in development server at localhost on port 8888?
  • Video class: PHP For Beginners, Ep 4 - Variables 07m
  • Video class: PHP For Beginners, Ep 5 - Conditionals and Booleans 11m
  • 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 - Arrays 08m
  • 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 Arrays 07m
  • 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 Filtering 12m
  • 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 Functions 12m
  • 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 Template 08m
  • 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 Links 11m
  • 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 - Partials 09m
  • 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 Styling 12m
  • 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 Router 18m
  • 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 Database 06m
  • 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 Steps 14m
  • 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 Class 10m
  • 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 Flexibility 13m
  • 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 Explained 10m
  • 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 App 07m
  • 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 Page 14m
  • 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 Authorization 14m
  • 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 Rewriting 12m
  • 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 Methods 18m
  • 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 Input 08m
  • 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 Validation 12m
  • 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 Class 11m
  • Exercise: Why can the validation method be made static in the Validator class?
  • Video class: PHP For Beginners, Ep 29 - Resourceful Naming Conventions 06m
  • 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 Extraction 19m
  • 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, How 12m
  • 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 Router 20m
  • 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 Controller 07m
  • 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 Container 19m
  • Exercise: In a simple service container, what does calling resolve do?
  • Video class: PHP For Beginners, Ep 36 - Updating a Resource With PATCH Requests 21m
  • 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 101 13m
  • 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 User 19m
  • 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 Middleware 22m
  • 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 Career 04m
  • 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 Out 25m
  • 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 Object 13m
  • 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 Class 13m
  • 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 Session 05m
  • 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 Validation 26m
  • Exercise: What is a key benefit of throwing a custom ValidationException during form validation?
  • Video class: PHP For Beginners, Ep 47 - Composer and Free Autoloading 13m
  • 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 PestPHP 15m
  • 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 2160p 18m
  • 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 Journey 16m
  • Exercise: In a new Laravel project, where are the web routes typically defined?

This free course includes:

10 hours and 45 minutes of online video course

Digital certificate of course completion (Free)

Exercises to train your knowledge

100% free, from content to certificate

Ready to get started?Download the app and get started today.

Install the app now

to access the course
Icon representing technology and business courses

Over 5,000 free courses

Programming, English, Digital Marketing and much more! Learn whatever you want, for free.

Calendar icon with target representing study planning

Study plan with AI

Our app's Artificial Intelligence can create a study schedule for the course you choose.

Professional icon representing career and business

From zero to professional success

Improve your resume with our free Certificate and then use our Artificial Intelligence to find your dream job.

You can also use the QR Code or the links below.

QR Code - Download Cursa - Online Courses

More free courses at Web Development

Free Ebook + Audiobooks! Learn by listening or reading!

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate