Currently I am struggling with finding the best approach, to implement the following, maybe not everyday, requirement.
I plan to develop a Laravel application. The very general idea of this application is to generate the for websites, which are based on Laravel too, but completely working independent. So as an example: I, as an user, login to the Laravel application, create a new record „Webseite“ in the database and have, let’s say about 50 settings to individualize the website. To have some example of settings, this could be: the logo on the website, decision if the website should have a blog or not, the theme color to used in bootstrap variables, etc. After I have configured the website, I press a button and the Laravel application generates the code for this website, which works on Laravel too. In our case, we are building Statamic websites. So, after this process, I can download a Zip or even better everything gets moved to a new Git repository for this website and in this repository, I have all the files (app, bootstrap, config, content, database, .env.example, etc…) I need to get my Statamic running on any server. Now I have just to clone this new generated repository (or upload the Zip) to any server, run composer install & cp .env.example .env and website is ready to go.
In other words, with this Laravel application I want to write/generate code for another Laravel website. Code in this case means:
- PHP (configs, routes, …)
- YAML (Statamic blueprints, ….)
- Statamic Templates (would prefer to you blade for Statamic instead of Antlers)
- JS (frontend)
- SCSS (frontend) And in all these files, I need to use blade-directives as I need to manipulate all these files, depending on the settings of the website.
Without a doubt, it’s technically no problem to do this. To have an config-app-php.blade.php which renders the config/app.php, or to have a app-scss.blade.php, etc.
But for me, it feels wrong to re render PHP, SCSS, JS or even worst, Blade-Template-files from Blade-Template-Files
Do you have any ideas, if there is a better way to implement this?
Thank you very much!