M
M
Mors Clamor2021-02-05 23:54:30
PHP
Mors Clamor, 2021-02-05 23:54:30

How to design a framework?

Hello! I am writing a small framework for myself for educational purposes. I made a base - parsing the route, calling the method. And already at this stage, a plug - for example, I want to shove something like a Pipeline (chain of responsibilities) there to process the request (middleware if it's easier). How to design a framework in such a way that in the future it would not be necessary to shovel all the code, including the core, in order to introduce new elements? I understand about SOLID there, but if you follow the single responsibility rule, then there will be just a whole mountain of files, and this is directly in the framework. The question also arises, for example, I now have routing a la microframework, in order to fasten MVC, I need to implement a controller search and a method call. Should this be done in a separate class?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
F
FanatPHP, 2021-02-06
@66demon666

https://youtu.be/u95A0tyoY7I?t=300

N
Northern Lights, 2021-02-06
@php666

I understand about SOLID there, but if you follow the single responsibility rule, then there will be just a whole mountain of files,
Yes. so it will be
The question also arises, for example, I now have routing a la microframework, in order to fasten MVC, I need to implement a controller search and a method call. Should this be done in a separate class?
no need to ask such questions. If you write something, you must be sure of the correctness of your architecture. Otherwise, you will ask a question for every sneeze.
I am writing a small framework for myself for educational purposes
in general , the idea is absolutely stupid, harmful and will only lead you to burnout . For in fact, you will work for free, do something, but there will be no sense . I myself wrote the framework for several years in my free time, I wrote it, but it’s better for you to spend it all studying what is now and making the final product - it will be more useful. Plus experience on the actual tool in karma.
Any framework now is a collection of dozens of cubes, each of which was developed and tested by dozens or even hundreds of people, the best professionals in their field. Trying to write your own framework at the age of 21 is like designing a car alone, BETTER than world analogues. The analogy is about the same, i.e. it's impossible.
Don't do nonsense.

A
Anton R., 2021-02-06
@anton_reut

How to design a framework in such a way that in the future it would not be necessary to shovel all the code, including the core, in order to introduce new elements?

I understand about SOLID there...

You don't understand, since there are such questions.

M
Maksim Fedorov, 2021-02-06
@Maksclub

Framework from start to finish (with pipelines, middleware and container):
https://youtube.com/playlist?list=PLE20id3DjfFnio1...

A
Alex Wells, 2021-02-06
@Alex_Wells

If you can’t figure out 100% why and what is used where in https://github.com/phpstan/phpstan-src/tree/master... (at least in this namespace), then forget it, it won’t work out well.
Funny videos are not worth watching. It is impossible to explain how to really do it well without experience and without knowing why someone does it the way they do it (like the phpstan team).

A
Anvar Shakhmaev, 2021-02-06
@RxR

First you need to study and learn how to practically apply: algorithms and data structures, design patterns. And try to design.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question