Answer the question
In order to leave comments, you need to log in
How to store data in your composer package?
Where does composer packages store data, and do they store it?
There is a task - to create a package that will use and periodically update (from someone else's API) tabular data, the question arose - where to store this data? Force installation migrations to your database during installation? Use a file database of some kind? Nowhere can I get information about whether composer packages are allowed to expand in size during operation, for example (along with expanding the database)
I would be very grateful if you could help with the questions above, and even more so if you could suggest specific convenient tools (db, orm, resources about your composer packages, etc.)
Bonus question: Including as a dependency to a yii2 package - would it be too bad a tone?
Thank you!
Answer the question
In order to leave comments, you need to log in
The data should be stored outside the package directory, because the vendor is often wiped clean during deployment.
Therefore, they can lie anywhere, the package should make it possible to indicate this place.
Whether it will be a database or something else, the package must determine, and its users must implement this contract. You can make adapter packages (for mysql, for file storage, etc.) so that the user can choose how to store data.
Connecting as a dependency to a yii2 package - would it be too bad a tone?If your package is supposed to be framework-independent, then yes, so-so solution. If it is closely related to Yii2, then why not...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question