Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRicardo Vargas
3,583 Pointswhat are the advantages on an MVC vs a PHP application?
you can update data within PHP and then load it , angular js seems to do the same, what are the main differences and why both exist?
3 Answers
Alexander Smith
2,769 PointsI think you're a bit confused. MVC can be used a long with PHP. MVC isn't a language it's a way of handling things. It's about seperating everything into three distinct categories to keep them separate. A simple analogy would we be HTML and CSS. You don't want the styling in your HTML so you keep it completely separate with CSS.
MVC is the same concept but a little more to it.
Model - Probably a database and is where data is stored.
View - The output it's whats handles how data is displayed (for web it will be your templates)
Controller - The middle man (your php in your case it sounds like). It does all the work and takes or changes info in the model. IT also will work with your view by telling it what to display.
Andrew VanVlack
20,155 PointsMVC is a concept for how you setup your applications while PHP is a language. You can set your PHP application in a MVC way. If you are talking about PHP vs a framework like angular it is that PHP is a server side language and angular is a front end framework using javascript.
You can use angular and a PHP server together. Parts of them do replace each other as you noticed. Updating all your data on the front end of an application can make it a lot faster as you do not have to request a page load every time you change part of the data. You can do the loading loading form php in pure javascript but a framework makes it a lot easer for when there is so much going on in your application.
So few things to note.
Front End Language: Javascript, Framework: Angular (MVC)
Back End Language: PHP, Famework: Laravel (MVC)
Ben Myhre
28,726 PointsTwo different things.
The advantage of MVC (or any architectural pattern) is that you are creating readable, consistent, code that helps you implement basic programming concepts like Separation of Concerns and Single Responsibility.
Someone can make a PHP language with MVC in mind, but they are two separate things.
Ricardo Vargas
3,583 PointsRicardo Vargas
3,583 PointsGreat explanation, Thanks.
Justin Walters
PHP Development Techdegree Student 18,894 PointsJustin Walters
PHP Development Techdegree Student 18,894 PointsExcellent explanation.