Lazy-populate data #4
Replies: 5 comments
-
How about having a modular system based on multiple Composer packages? Each model is contained within its own package. |
Beta Was this translation helpful? Give feedback.
-
It could work, tbh my biggest fear is mainly about multi languages, because if a package |
Beta Was this translation helpful? Give feedback.
-
From v2, Squire will be split into multiple composer packages. Each will contain a translation for just one model. For example, to use the
All translations are easily updated, the same as you would with any other package. |
Beta Was this translation helpful? Give feedback.
-
Huge, thanks and great work! |
Beta Was this translation helpful? Give feedback.
-
All models (and multiple translations) in v2.0.0 are provided by different packages. |
Beta Was this translation helpful? Give feedback.
-
It's not really an issue, but a suggestion: it would be nice to not have every single file already populated in the repository but, instead, let the user download their desired data. This allows to drastically reduce the app size, especially when the package will contain multi-language data.
For example the
airports.csv
is 3.26MB and it's a lot. I thought a solution like this would help.Solution 1
$ php artisan squire:download {resources*} $ php artisan squire:download airports
squire:download
command will check if the file exists and if it's signature is not the same as the latest version available. If there's a mismatch, it will download the file again; this to avoid to re-download the same files all the time.squire-data
repository maybe) is put in aresources/squire
folder in the user project.resource_path('squire/airports.csv')
And it would fit with different languages too:
$ php artisan squire:download {resources*} {--locale}
Solution 2
Everything like solution 1, but instead of passing the desired resources and languages in the command, the package could create a
config.squire.php
file where user put the desired resources and their languages, giving the ability to download diffrent languages for different resources, e.g.Airports -> en, Countries -> en, it
.Then the command would be just
php artisan squire:download
.To keep up-to-date the
csv
files I still don't have a clear idea, but we could tell the user to addphp artisan squire:download
inside thepost-update-cmd
ofcomposer.json
or just to manually pull the data sometimes.Beta Was this translation helpful? Give feedback.
All reactions