Answer the question
In order to leave comments, you need to log in
How to organize work with a database in a library?
Hi all.
There is a custom library that I made, all of its methods interact with the database, but the configs for connecting to the database and tables are in a separate file, how would it be more correct to organize work with the database in order to get rid of the config file, but not tire the user by entering these data to the class constructor?
Answer the question
In order to leave comments, you need to log in
Write a factory that will take data from the config and pass it to the constructor of your library.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question