A
A
AusTiN2010-11-08 18:08:41
PHP
AusTiN, 2010-11-08 18:08:41

I want to learn MVC in PHP, where do I start? Which framework to choose for the project?

Actually, two questions:
1) I want to learn the MVC approach in PHP, where to start, what to read? (Preferably in Russian for faster perception)
2) Now I'm starting a new project, I think that it is necessary to take some kind of framework to facilitate development - but which one?
Guru, tell me please :)

Answer the question

In order to leave comments, you need to log in

18 answer(s)
N
nikel303, 2010-11-08
@nikel303

Try Yii - a compact, promising framework, there is Russian documentation and a forum.

K
kirsan_vlz, 2010-11-08
@kirsan_vlz

Most likely I will raise a lot of objections, but if time permits, to understand MVC, I would advise you to start writing a project without a framework.
I'll explain why.
When I started to understand PHP, the frameworks were almost not developed, the topic was not very popular. Yes, and my level was not the one to understand such a design. And, like most novice programmers, I started reinventing the wheel. Made one site. When expanding, it turned out that it was categorically inconvenient to expand some places. I thought about it, looked at the sources of other projects (then it was the IPB 2 forum), borrowed some architectural solutions, but without understanding their essence. Then for the first time I heard about frameworks, I saw that some ready-made parts of my code can be arranged and separated into your own platform. Then I already roughly understood OOP, I began to read the Big Four patterns. In the course of development, I often stepped on a rake, rewrote entire subsystems, looked at some points in existing frameworks, with each mistake came an understanding of why in serious platforms it was done “this way and not otherwise”. Over time, I got to the point where my “framework” had to be redesigned from scratch, and then it would become very convenient, very extensible and in general ... And at the design stage, it came to the understanding that all this had already been written before me and it makes no sense for me to write anything already no. Only by this moment I perfectly understood, I understood, but did not know, many of the techniques used in MVC frameworks. And since the general essence of them is similar, the time for studying new frameworks has been significantly reduced due to understanding the principles of their work. Many points are clear simply from the source code and examples of use, without documentation. when my “framework” needed to be redesigned from scratch, and then it would become very convenient, very extensible, and in general ... And at the design stage, it came to the understanding that all this had already been written before me and it makes no sense for me to write anything anymore. Only by this moment I perfectly understood, I understood, but did not know, many of the techniques used in MVC frameworks. And since the general essence of them is similar, the time for studying new frameworks has been significantly reduced due to understanding the principles of their work. Many points are clear simply from the source code and examples of use, without documentation. when my “framework” needed to be redesigned from scratch, and then it would become very convenient, very extensible, and in general ... And at the design stage, it came to the understanding that all this had already been written before me and it makes no sense for me to write anything anymore. Only by this moment I perfectly understood, I understood, but did not know, many of the techniques used in MVC frameworks. And since the general essence of them is similar, the time for studying new frameworks has been significantly reduced due to understanding the principles of their work. Many points are clear simply from the source code and examples of use, without documentation. used in MVC frameworks. And since the general essence of them is similar, the time for studying new frameworks has been significantly reduced due to understanding the principles of their work. Many points are clear simply from the source code and examples of use, without documentation. used in MVC frameworks. And since the general essence of them is similar, the time for studying new frameworks has been significantly reduced due to understanding the principles of their work. Many points are clear simply from the source code and examples of use, without documentation.
Yes, it will take a lot of time, but there will be no problems with changing the framework. Yes, even the language. I wrote my first application on Rails after I got to know it (before that I had nothing to do with ruby) in three days, starting with “how to install Ruby”. It was an inbox-mailbox interface with a bunch of Ajax and all sorts of goodies like search, filters, and more.
So, if, of course, time permits and there is a desire, I recommend either trying to write your own bicycle, or disassembling any ready-made framework until you fully understand it, it doesn’t matter which one.

C
casey, 2010-11-08
@casey

Zend Framework is cumbersome, big, slow - but as an example of building OOP systems - it's perfect. Lots of examples, huge community.

V
Vertex, 2010-11-08
@Vertex

www.symfony-project.org/ - there is one promising framework ... brainfuck a little at first, but ok ... )

S
slang, 2010-11-08
@slang

I would definitely recommend Zend as a Swiss knife that can cut any desired detail of decent quality, but! But it will not be easy to figure it out in a hurry, so you should start with a kitchen knife, the simplest lightweight analogues of the CodeIgniter type (good dock, understandable structure, easy transition from it to Zend). As for MVC, this is a trend, and it is implemented in almost all modern frameworks.

R
rapida, 2010-11-08
@rapida

CodeIgniter

M
MyraJKee, 2010-11-08
@MyraJKee

cakephp for small projects. Not the smartest, of course, but in my opinion, MVC is well implemented, a clone of Ruby ...
The documentation is excellent, there is in Russian .
A lot of things implemented, in general I recommend.
cakephp on habré , google group
Also worth a look at kohana
Yii and Zend have already recommended ...

E
Evgeny Elchev, 2010-11-08
@rsi

Everyone here has already advised, but I will add my 5 kopecks. I myself am literally writing the first project using the framework, I tried symfony, yii and zend, and this is purely my opinion:
Zend - I had to think about it in order to install, configure zend_tools and connect it all to netbeans. I re-read a bunch of forums in order to implement the correct authentication and authorization (there are plenty of examples on the Internet, but they are either outdated or not complete), then it went easier, but still often have to refer to forums and documentation.
Yii - it was quite easy to install, it was very easy to create a project, it has its own generator when, but I didn’t like it in it, instead of mastering it from scratch, I had to understand the code already written that I didn’t understand, although there is good documentation in Russian
Symfony - also just installed, the project was not created the first time but not difficult, I immediately connected good documentation to netbeans, including in Russian, I liked the built-in orm doctrine, but then there were difficulties with examples from the documentation (perhaps due to my curves hands) and I quit studying.
As a result, I write on zend (perhaps because I tried it first) I have advanced quite far, due to the fact that I write almost all the code myself, I understand it well.

C
calg0n, 2010-11-09
@calg0n

I would advise you to first understand what OOP is in general and what it is eaten with, and then rush to various MVC frameworks. There is a very good book in Russian: PHP 5 for professionals . It contains a lot of things (including about MVC).
Here it is more important to understand exactly OOP and how to prepare it, rather than MVC. MVC is just a way (concept) of separating logic and nothing more. Having studied OOP from now to now, you will then click frames like nuts, and the answer to the question “Which framework to choose for the project?” won't make you wait long.
Well, I started with CI, then a bit of Cake, ZF, and finally settled on Yii.

V
Vyacheslav Plisko, 2010-11-12
@AmdY

Just look here
martinfowler.com/eaaCatalog/modelViewController.html
for another picture, there is also a link to the description of all parts of the system.
www.corej2eepatterns.com/catalog.
then it's better to dig into the Zend Framework and start programming in Symfony.
But until you read smart literature, it’s better *don’t get* into php MVC frameworks, I tell you as an experienced php-shnik.

A
Anton Chekhov, 2014-01-10
@chekhovrussia

And no one advised Laravel ?

M
MniD, 2010-11-09
@MniD

Let HOLIVAR come!
I started with ZF - a cool thing, a lot of features, a huge community, but a slow bitch ...
Now I moved to Yii - small, convenient, various convenient bells and whistles ... and one ActiveRecord is worth it, mmm ... in general, I advise it ...
KakaPHP (CakePHP) - slow, not convenient, outdated framework... but this is purely my personal opinion...

A
Anton Korzunov, 2010-11-09
@kashey

I would recommend looking at Kohana as the second and third versions (dramatically different)
In general, the libraries there are different and the frameworks set you the order of actions invented (and thought out) by other people.
This is not the correct approach. Try a couple of frameworks, try to tear them apart, hack and write your own.
At the end, enlightenment awaits you, a conscious choice of a framework and a deep understanding of how it works.
The latter is very useful.
I'm very fond of object-oriented patterns.
But they demolish mosk to other programmers. That's why I love them exclusively at home :)

I
icegreenberry, 2010-11-09
@icegreenberry

We used Yii, ZendFramework, Symfony in our projects. We settled on the latter because: the admin panel generator, a lot of plugins.
From personal impressions:
Zend is very large, inconvenient work with forms. But it has many advantages - the component structure allows you to use only what you need, even in other projects - by connecting Zend classes. Also of the pluses is the architecture, code style, powerful search engine Lucene.
Yii is smart, understandable. Nimble thanks to lazy loading, understandable thanks to the author and the simplicity of the architecture :) Recently, a lot of new plugins have appeared, the wiki is developing. The Russian-speaking community is developing (thanks to samdark.habrahabr.ru/ ). Personally, I like Yii the most so far.
Symfony is also big, but runs faster than Zend. Lots of cool plugins, good manual (including in Russian). Good community and talented author (Fabien Potencier). Symfony2 is being prepared for release - a completely redesigned Symfony. Symfony2, I think, will be a breakthrough in the world of PHP frameworks (largely also thanks to the new features of PHP 5.3). Doctrine ORM works out of the box, which, if desired, can be easily screwed into any framework, but still. The admin panel generator is essentially a regular CRUD, but thanks to the settings files, it is very easy to remake it to fit your needs. In addition, I personally prefer the YAML-way - setting everything through * .yml files.
Something like this.

@
@nstorm, 2010-11-13
_

For me, of course, the first comment gives the most practical advice, I also always reinvent the wheel when I want to understand something. But if you take a framework, then for studying CI the simplest and most understandable in my opinion, with good logical documentation

V
Vitalii Bodnar, 2013-11-20
@wbvetal

The essence of the matter is very well described here !!!
http://habrahabr.ru/post/150267/

X
xolnimda, 2014-09-12
@xolnimda

Good video on MVC mvcphp.ru

R
Roman Mavlyutov, 2019-01-26
@Roma-Pro

There is a special plugin that adds simple yet powerful MVC functionality to Wordpress MVC
Yes, Wordpress is very popular. There are many ready-made solutions (plugins, themes). However, it is not very convenient to develop non-standard functionality. You constantly have to manually write the most banal things, like html code for forms, form processing, etc.
This plugin is just to get rid of such a routine. And developing on Wordpress is fast and convenient. And at the same time have all the advantages of this most popular cms.
Look at the link there is a small review. And there are step-by-step instructions with video examples in Russian, so you can easily figure it out :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question