Is CakePHP v4.x support 3-Tier architecture?

Dear Team,

We are using CakePHP v4.x on a LAMP environment and would like to implement as 3-tier architecture such as
a) Presentation Tier
b) Application Tier
c) Data Tier

So would you able to guide any reference or advice that, how to implement it.
For your information:
a) Data tier will be the CakePHP database
b) Application tier will be the CakePHP application
c) Not sure, what will be in the presentation tier?

Looking forward any lights on me, please

Thank you,

Don’t get stuck up on fancy naming paradigms. Your 3-tiers sounds very much like MVC:

  • Model (all the stuff under src/Model folder of your CakePHP app)
  • View (src/View. View layer uses the templates folder too)
  • Controller (src/Controller)

Bingo! Your CakePHP app is 3-tiered.


Model = Data
View = Presentation
Controller = Application

1 Like

In a three tier architecture, the presentation tier never communicates directly with the data tier; in a three-tier model all communication must pass through the application tier. Conceptually the three-tier architecture is linear. However, the MVC architecture is triangular: the view sends updates to the controller, the controller updates the model, and the view gets updated directly from the model.


MVC isn’t always triangular.
In my app, it’s more similar to a 3-tier.

On my website, views never interact with my models directly (always passing through a controller or something similar to a controller).

Can you elaborate on what you mean by “the view gets updated directly from the model”?

something like, does CakePHP support on 3-tier architecture environment?

It seems, CakePHP doesn’t support 3-tier architecture because 3-tier architecutre is a linear, where as CakePHP is MVC triangular

You are mixing two different concepts, architectures and programming/design patterns. CakePHP would usually be the business tier in a 3-tier architecture, and in that scenario it’s completely irrelevant what design pattern it uses.

A simple example of a 3-tier web application architecture would be a Vue.js GUI frontend application (presentation tier), a CakePHP API backend application (business tier), and a MySQL database (data tier). In that example all 3 tiers could exist independently from each other on separate servers.

Thank you and correct me, if I’m wrong on this scenario please

Use any other user interface UI on the presentation layer and call to backend CakePHP [e.g. via API] to manage the request and response through presentation layer to client browser.

CakePHP will be in the business layer and request and response will be via API between presentation and business layer. So CakePHP cannot be split the programming/design pattern into separate servers due to MVC patterns.

Data layer as it is, it will be the database.

Thank you

This kinda sounds like you seem to mix up architecture and design pattern again. The 3-tier architecture has nothing to do with patterns such as the 3-layer MVC design pattern, the former describes a (typically client-server) architecture with three logically and physically separate units of computing, the latter describes design patterns that could be used to build a single tier. MVC is a pattern that can typically be found in the presentation tier as well as the application tier.

You’ll find many resources on the web and elsewhere that do get that wrong, they talk about layers and tiers as if these are interchangeable terms, but that’s not the case, a tier is not only logically separate, but also physically, and a layer is logically separate, but not necessarily physically. So long story short, a layer can be a tier (depending on the used technology), or, which is the common case, part of a tier, but a tier cannot be a layer.

Splitting layers of a PHP web application framework into tiers, is just… it doesn’t fit, that’s just the nature of the technology, and not specific to MVC designs. Just think about it, how would a PHP based model layer on a separate tier work? A model cannot do anything on its own, there would need to be a PHP script that accepts requests and delegates the work, at least a front controller, and off we go, we’re creating multi-layers again.