
Build a completely custom object oriented php and mvc framework called traverse mvc, then develop the share posts app with user authentication and full crud.
Access the per-lecture project files zip to reference code as you progress, and post errors or zipped code and sql dumps in the Q&A for help in alpha stage.
Set up a XAMPP environment with Apache, MySQL, and phpMyAdmin to run PHP locally; test via localhost/test and secure the root password, then enable PHP IntelliSense in VS Code.
Explore the basics of object oriented PHP concepts: classes, properties, methods, access modifiers (public, private, protected), magic methods, class inheritance, and static methods and properties as a project primer.
Explore the fundamentals of object oriented programming, where classes are blueprints for objects with properties and methods, offering modular, reusable, and maintainable code over procedural approaches.
Explore the basics of object oriented programming in PHP by defining a user class with properties and methods, instantiating objects, accessing properties, and using this to reference class data.
Explore PHP object oriented concepts by implementing constructors and destructors in a user class, automatically initializing properties, managing object lifecycles, and using magic constants to identify the class.
Master access modifiers in PHP by using public, private, and protected properties, and implement getters and setters, including magic methods __get and __set for safe, extensible access.
Explore inheritance in PHP by extending a user class to access protected properties and methods from a customer class. See constructors and parent::__construct used to initialize data.
Explore the model view controller pattern, its roles in data handling, user interfaces, and request routing, and see how PHP frameworks implement MVC with a PDO-based database layer.
Explore how an open source mvc framework routes requests via htaccess, loads controllers and methods like index, add, and edit, and passes data to views for a SharesPost app.
Create the Traverse MVC folder structure with public and app directories, libraries, models, views, controllers, helpers, and routing through index.php.
Route all public requests through the public index.php by enabling mod_rewrite and routing missing files to index.php. Require app/bootstrap.php and initialize the core library to manage URL handling.
Add a root access file to replace the public directory in the bootstrap, then load the core class and route requests by parsing the URL as /controller/method/params.
Retrieve and sanitize the URL from the request, split it into segments, and route the first segment to a controller in app/controllers; if not found, load the default pages controller.
Explore mapping methods and parameters in a PHP MVC setup by routing URLs to controller methods, validating methods, handling parameters, and calling functions with arrays of parameters.
Create a base controller in PHP that loads models and views, allowing derived controllers to instantiate models and pass data to views.
Extend the base controller to load views, create a pages folder with index and about views, pass data via an associative array, and include header and footer.
Centralize configuration in a php mvc app with a config file, define app route and url route constants, set the site name, and implement an autoloader for libraries.
Create reusable header and footer includes in a PHP MVC app, wiring header with the site name and CSS, and the footer with main.js via app root and URL route.
Explore how to use PDO for database access in a PHP object-oriented approach, including DSN creation, prepared statements, and performing CRUD operations safely.
Build a PDO-based database class with config constants, a DSN, and persistent options. Enable exception handling and test using prepared statements with a post model and local database.
Build an object-oriented PHP database class with query, bind, execute, and fetch methods in an mvc workflow. Retrieve and display posts via a model and view.
Delete the post model and unnecessary loading in the core MVC framework, wrap Traverse MVC as a zip, and update config and rewrite base for the share post application.
Set up the share posts app within the MVC framework, configure the database, and prepare the home view; create the share posts database with users and posts tables.
Build a php mvc app with bootstrap styling, a responsive navbar, and a container layout using cdn assets, enabling dynamic home and about pages and a version constant.
Create a users controller in an object oriented PHP MVC app, handling register form display and post submission, initializing form data and error variables, and loading the register view.
Build bootstrap-based register and login forms with name, email, password, and confirm password fields, posting to /users/register and /users/login, including inline error handling and navigation between forms.
Implement form validation for register and login in an object oriented PHP and MVC course by sanitizing inputs with filter_input_array, trimming whitespace, and validating email, name, and passwords.
Registering checks the database for existing emails via the user model, using prepared statements and bound parameters to query the users table and return true or false for email availability.
Learn to securely register users in PHP by hashing passwords with password_hash, storing hashed values, validating data, and redirecting to login with MVC helpers and session flash messages.
Create a session-based flash messaging helper in a PHP MVC app, store messages in the session, render Bootstrap alerts in views, and ensure messages unset after display.
Validate user login by finding the user by email, verify the hashed password with password verify, and prepare session data for a successful login using a reusable model function.
Learn to authenticate with password_verify, create a user session by storing id, email, and name in session variables, and manage login/logout with redirects and is_logged_in checks.
Create a posts controller with an index method. Set up the model-view-controller workflow with header and footer and a two-column posts page and an add post button.
Implement access control for posts by requiring login, redirecting to login when not authenticated, and using a session helper to check if a user is logged in.
Create a post model to fetch posts with a join to users for author names, then render posts in index view as bootstrap cards with title, body, and more button.
Add a post form in a PHP MVC app by building a post controller method and an add view, featuring title and body fields with validation, and a back button.
Insert posts by handling post submissions, sanitizing and validating title and body with the session user id, saving via the posts model, and displaying a post added message.
Implement a show action in the post controller to fetch a post by id, load its user, and render a show view with title, body, and edit or delete options.
Implement an edit workflow by reusing the add method, enforce ownership, load current post data, and update via the post model with validation and flash feedback.
Implement delete functionality in a pure PHP MVC app by adding a delete post controller and model, enforcing post requests, flashing 'post removed', and ensuring only the owner can delete.
Deploy your php app to a shared hosting account, configure the remote database, edit the config, and upload files with FileZilla, then verify the site works.
In this course we will go step by step to build a complete custom MVC (Model View Controller) framework Called TraversyMVC using object oriented PHP. We will build something similar to Codeigniter but much much lighter. This framework is completely open source and you are free to change the name, add stuff, etc and use it as your own. This framework will include...
A core library class to load controllers & methods from the URL (Also using .htaccess)
A base controller class to load models and views
A custom database library using PDO for all models to interact with the database using prepared statements
Not only will we create the framework but we will build an application on top of it called SharePosts which will be somewhat of a social network to share posts. This application will include..
Full user authentication
Access control for posts
Server side form validation
Bootstrap 4 UI
Posts CRUD
Helper functions (flash messaging & redirects)
We will also be deploying the application to the Internet
This is not a beginner PHP course. You should already understand things like variables, arrays, loops, functions and all of the basics of the PHP language. It is ok if you do not understand OOP fully. Before we start the framework project, we will have a crash course on object-oriented programming with PHP, where you will learn about classes, methods, properties and more.
To learn the basics, please check out the PHP Front To Back series on YouTube by Traversy Media