Answer the question
In order to leave comments, you need to log in
Web application on Symfony Components, how to?
Welcome all!
I decided to write a simple web application for user registration and authorization for learning purposes.
The task is to work with third-party libraries and not use frameworks (I write in Yii myself).
There is only bare PHP and Composer.
I began to look at how to solve the following tasks:
1) The application has a FrontController, use routing.
2) Namspaces, autoload of libraries - everything to make it beautiful.
3) Divide the application according to the MVC pattern, attach ORM, template engine for output, use bootstrap for layout, write the User entity with authorization and registration methods.
4) If it is ready to make migrations so that you can deploy the project.
5) Write unit tests and acceptance tests
I read that almost everything can be done using Symfony libraries, well, ok, why not.
Selected libraries:
ClassLoader, HttpKernel, Form, Security, Propel ORM.
Questions:
It seems that there are examples and everything is ok and easy, but still Symfony does not promote MVC and there is no layer such as a model (unlike Yii, for example).
Then how to deal with it? There is a form component for data validation and filling in authorization-registration fields, there is an ORM, but how can I connect both validation and records through ORM to the User object.
How to do it right from the point of view of logic?
Also a question about the template engine, what do you recommend?
I think that for authorization and authentication also use the corresponding components, or is it already too much?
Answer the question
In order to leave comments, you need to log in
If you really want to understand how to build your bikes, and even more so, bike designers (you are going to use libraries), try Silex. This is a microframework that only has httpkernel, router, Container. It is written in 2 files, chtoli))) so if you figure out how it is implemented there, it will be the biggest experience.
And any connection of the Symfony library, through your ServiceProvider (not ready!) will turn into wonderful evenings spent in the wilds of the code of these same libraries :).
PS. I personally tried everything described above - the result is fire
Divide the application according to the MVC pattern,
Add the necessary directories, for example, models, classes, etc., add them to composer.json (if necessary), that's it. Can be used. There are few options for the template engine, either as twig was recommended above, or write your own, or pull it out of existing frameworks, for example, blade from laravel (in my opinion, it’s even pulled out somewhere in composer)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question