Skip to Content
The Art of Modern PHP 8
book

The Art of Modern PHP 8

by Joseph Edmonds
October 2021
Intermediate to advanced content levelIntermediate to advanced
420 pages
7h
English
Packt Publishing
Content preview from The Art of Modern PHP 8

Chapter 8: Model, View, Controller (MVC) Example

In this chapter, we're going to learn about the Model, View, Controller (MVC) pattern by building our own toy MVC system. We'll start off by revising what MVC actually means. With that understanding in place, we will then work through creating our own toy version – starting off with the Controller layer to handle requests, then the Model layer to work with data, and finally the View layer to render some HTML.

We will actually run the code and confirm that it all works with some test code to simulate a browser visit and the PHPUnit test class to confirm it really is all working.

This chapter will cover the following main topics:

  • Model, View, Controller – MVC
  • Controller
  • Model
  • View
  • It lives

As ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern PHP

Modern PHP

Josh Lockhart
The PHP Workshop

The PHP Workshop

Alexandru Busuioc, David Carr, Markus Gray, Vijay Joshi, Mark McCollum, Bart McLeod, M A Hossain Tonu
PHP 8 Basics: For Programming and Web Development

PHP 8 Basics: For Programming and Web Development

Gunnard Engebreth, Satej Kumar Sahu

Publisher Resources

ISBN: 9781800566156Supplemental Content