J
J
javanub2015-11-01 21:43:17
symfony
javanub, 2015-11-01 21:43:17

Did I understand how frameworks work correctly?

Did I understand correctly that from the framework, roughly speaking, I use routes, controller and views. This is a frame. In the controller I use ready-made functions, for example, working with the database. But if I want to write, for example, cropping a photo with a square, then should I implement my own bike? That is, half of the functionality is the functions of the framework, half are my bikes...

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Ivan Brezhnev, 2015-11-01
@javanub

If it is work with photos, then there is a "mountain" of ready-made libraries, for example, image.intervention.io/getting_started/installation...

S
Sergey, 2015-11-01
Protko @Fesor

Frameworks are a set of ready-made solutions for standard tasks. Think of them as a bunch of separate libraries. Let's say it makes no sense to write again and again the routing of requests, etc. from time to time.
The main task of the controller is to be an intermediary between the presentation of data (HTTP, for example, or a web interface, or CLI) and the logic of their processing. That is, you can work with the database in the controller, but it is not recommended (only if you know what this can lead to and why thick controllers are bad).
The rest of the application logic, business logic, is pure and beautiful PHP. For convenience, sometimes you can slightly increase the cohesion of the application code and libraries that you use, but again, this is not very good and you should understand what this can lead to.
Similar functionality, cropping pictures, working with graphics, etc. already implemented before you. Usually, all a developer needs to do is wrap it up with a beautiful interface that will hide all the details of how images are processed.
Not great, but business logic. The framework provides you with a framework, a solution to common problems. In the case of simple CRUD, the ratio of your code to library framework code can be 1/10. In the case of complex business logic and specific infrastructure - 10/1.

A
Alexander Taratin, 2015-11-01
@Taraflex

https://github.com/Folkloreatelier/laravel-image

V
Vyacheslav, 2015-11-01
@nskarl

the framework gives you a set of ready-made tools that you customize to fit your needs. and with good logic and the ability to use it, many bicycles can be avoided.
ZY work with basis, usually, goes in models where MVC structure. controllers accumulate and process everything that you invent and give to the view.

N
nirvimel, 2015-11-01
@nirvimel

routes, controller and views

It's called MVC, just one of the design patterns. Various frameworks are confused on MVC to varying degrees.
This is no longer great, but specific functionality for your specific task. So if you started writing your Unique Framework Suitable For Everything, then it would be 100% great.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question