DEV Community

M__
M__

Posted on

PHP MVC

So I got an internship somewhere and assigned a project that uses php...my knowledge of PHP is very basic to be honest and one of the specifications for implementing the project is using MVC.

I am familiar with the concept but I have tried researching and writing some code for the login and registration but every time I want to connect it to a database, a sea of errors is what I get.

I have tried looking for content online that can clearly explain the concept with easily understandable code but nothing so far.
Such are the struggles of a programmer...😞

Top comments (13)

Collapse
 
sebbdk profile image
Sebastian Vargr • Edited

MVC is an OOP pattern, do you have a specific framework in mind?

It's a rather old pattern tho, last i checked some of the more diehard MVC PHP frameworks have been slowly moving away from it, since there are more intuitive patterns.

I have not used PHP for years tho, so i am a bit out of the loop. :)

Collapse
 
idimaimuna profile image
M__

I was trying to see if I could use codeigniter but the concepts were challenging for me to grasp. The project is time sensitive so I don't have time to learn clearly as I'd like

Collapse
 
siimsoni profile image
Kristjan Siimson

While not CodeIgniter specific, Symfony vs Flat PHP does a good job explaining the concept.

Thread Thread
 
idimaimuna profile image
M__

Thank you.I'll take a look at it

Collapse
 
sebbdk profile image
Sebastian Vargr

CodeIgniter is a classic, should have plenty of tutorials/examples around for what you need, so at least you have that going for you. :)

Thread Thread
 
idimaimuna profile image
M__

When I look at codeigniter examples I get overwhelmed when I try them and they don't work on my side.

Collapse
 
thallesrangel profile image
Thallesrangel • Edited

I have a slightly different view, MVC is very used currently and majority use MVC how pattern.

Collapse
 
sebbdk profile image
Sebastian Vargr

Cool, again it's been a while since i did anything PHP. :)

For reference, do you have some examples?

Collapse
 
emanuelhfarias profile image
Emanuel H. Farias

I suggest you to take a look at MINI. It is a very simple example of application using MVC concepts. It does not uses any framework. Study the code, it's very simple to read.

Start small, build some CRUD applications.

After you get use to MVC concepts. Try some micro-frameworks, like Lumen. It gives you Routes, Authentication, Database and many more features.

Collapse
 
idimaimuna profile image
M__

I'll try looking at that. Thank you

Collapse
 
thallesrangel profile image
Thallesrangel

Yes, it's better way.

Collapse
 
Collapse
 
idimaimuna profile image
M__

Thank you...I don't speak Portuguese but I'll look at the others