Write PHP Like a Pro Build a PHP MVC Framework From Scratch
What you’ll learn
Separate application code from presentation code
Organise your PHP code into models, views and controllers in an MVC framework
Use namespaces and an autoloader to load PHP classes automatically
Use the Composer tool to manage third-party package dependencies and autoloading
Handle errors and exceptions in PHP and display more or less error detail based on the environment
Understand how MVC frameworks work, making it easier to learn an existing framework like Laravel or CodeIgniter
Requirements
You should already be familiar with PHP and HTML.
You should be comfortable installing software on your computer – in the first section we’ll be installing a web server.
Description
Learn the basic
concepts of using a model-view-controller framework that will make
your PHP projects faster, easier to write and maintain, and more
secure.
Learn to
Structure your PHP Code Like a Professional by Building a PHP MVC
Framework from Scratch.
Model-view-controller
(MVC) pattern conceptsBuild an MVC
framework in PHP from scratchSeparate
application code from presentation codeUse namespaces
and an autoloader to load classes automatically
Take your PHP
Projects to the Next Level
Learning how to use
an MVC framework puts a very powerful tool at your fingertips. Most
commercial websites and web applications written in PHP use some sort
of framework, and the MVC pattern is the most popular type of
framework in use.
The gap between
knowing PHP and using a framework can be huge. This course bridges
that gap. By writing your own framework from scratch, you’ll gain an
understanding of just how each component works. Frameworks like
Laravel, Symfony and CodeIgniter all use the MVC pattern, so
understanding how an MVC framework is put together will give you a
strong background to more easily learn frameworks such as these.
Content and
Overview
I designed this
course to be easily understood by programmers who know PHP but don’t
know how to use a framework. Are you putting database code and HTML
in the same PHP script? Want to know why this is a bad idea? Want to
know how to do it better?
Starting with the
basic concepts of MVC frameworks, this course will take you through
all the steps needed to build a complete MVC framework, a piece at a
time.
Beginning with a
single PHP script, each lecture explains what you’re going to add to
the code and why, building up the framework step by step. At the end
of this course, you’ll have built a complete MVC framework in PHP,
ready to use in your own projects.
Complete with
working source code at every stage, you’ll be able to work alongside the instructor
and will receive a verifiable certificate of completion upon
finishing the course.
Overview
Section 1: Introduction: MVC concepts and development environment setup
Lecture 1 Introduction
Lecture 2 The problem with writing web applications: how NOT to structure your code
Lecture 3 The MVC pattern: What it is and how it can help you write better code
Lecture 4 Install a web server, database server and PHP on your computer
Lecture 5 Start writing the framework: Create the folders and configure the web server
Lecture 6 Addendum: Additional configuration for AMPPS on Windows
Section 2: Routing: how URLs are processed in an MVC framework
Lecture 7 Create a central entry point to the framework: the front controller
Lecture 8 Configure the web server to have pretty URLs
Lecture 9 Addendum: Possible additional configuration required for the Apache web server
Lecture 10 Create and require (not include) the router class
Lecture 11 Create the routing table in the router, and add some routes
Lecture 12 Match the requested route to the list of routes in the routing table
Section 3: Advanced routing: add simpler but more powerful routes
Lecture 13 Introduction to advanced routing using route variables
Lecture 14 How to do complex string comparisons: an introduction to regular expressions
Lecture 15 Using special characters in regular expressions: advanced pattern matching
Lecture 16 Write even more powerful regular expressions: use character sets and ranges
Lecture 17 Extract parts of strings using regular expression capture groups
Lecture 18 Get the controller and action from a URL with a fixed structure
Lecture 19 Replace parts of strings using regular expressions
Lecture 20 Get the controller and action from a URL with a variable structure
Lecture 21 Add custom variables of any format to the URL
Section 4: Controllers and actions
Lecture 22 Controllers and actions: an introduction
Lecture 23 How to create objects and run methods dynamically
Lecture 24 Dispatch the route: create the controller object and run the action method
Lecture 25 How to better organise your classes by using namespaces
Lecture 26 Class autoloading: load classes automatically without having to require them
Lecture 27 Load classes automatically: add namespaces and an autoload function
Lecture 28 Remove query string variables from the URL before matching to a route
Lecture 29 Pass route parameters from the route to all controllers
Lecture 30 The __call magic method: how to call inaccessible methods in a class
Lecture 31 Action filters: call a method before and after every action in a controller
Lecture 32 Addendum: fix for a potential security bug introduced with the action filters
Lecture 33 Organise controllers in subdirectories: add a route namespace option
Section 5: Views
Lecture 34 Views: an introduction
Lecture 35 Display a view: create a class to render views and use it in a controller
Lecture 36 Output escaping: what it is, why do it, and how and when to do it
Lecture 37 Pass data from the controller to the view
Lecture 38 Templating engines: what they are and how they can improve your PHP code
Lecture 39 Make views easier to create and maintain: add a template engine
Lecture 40 Addendum: Changes in Twig 2.0
Lecture 41 Addendum: How to easily fix a potential exception when rendering a Twig template
Lecture 42 Remove repetition in the view templates: add a base template to inherit from
Section 6: Manage code using Composer
Lecture 43 Install third-party PHP code libraries automatically using Composer
Lecture 44 Installing and using Composer
Lecture 45 Install the template engine library using Composer
Lecture 46 Include all package classes automatically using the Composer autoloader
Lecture 47 Use the Composer autoloader to load the template engine library
Lecture 48 Add your own classes to the Composer autoloader
Lecture 49 Replace the autoload function with the Composer autoloader
Section 7: Models
Lecture 50 Models: an introduction
Lecture 51 Create a database and check you can connect to it from PHP
Lecture 52 An introduction to PDO: why it makes working with databases in PHP easier
Lecture 53 Add a model, get data from the database and display it in a view
Lecture 54 Optimise the database connection: connect only on demand and reuse it
Lecture 55 Erratum: Correction to the Optimise the database connection code
Section 8: Configuration and error handling
Lecture 56 Put application configuration settings in a separate file
Lecture 57 How PHP reports problems: errors, exceptions, and how to handle them
Lecture 58 Handle errors: convert errors to exceptions and add an exception handler
Lecture 59 PHP configuration settings: where to find them and how to change them
Lecture 60 Configure PHP to display error messages
Lecture 61 Show detailed error messages to developers, friendly error messages to users
Lecture 62 Categorise different types of error using HTTP status codes
Lecture 63 Add views to make error pages look nicer in production
Section 9: Conclusion
Lecture 64 A brief introduction to some popular frameworks
Lecture 65 Conclusion
Lecture 66 Bonus Lecture: Discounts on other courses
This PHP MVC course is meant for those who already know PHP but want to know how they can improve their code by using a framework. This course is not for you if you don’t already know PHP.,The gap between learning PHP and using a framework can be large – if you’ve just learnt PHP and you’re wondering what the next step might be, this course is for you.
Course Information:
Udemy | English | 2h 57m | 688.88 MB
Created by: Dave Hollingworth
You Can See More Courses in the Developer >> Greetings from CourseDown.com