ishanvyas22 / asset-mix

Provides helpers functions for CakePHP to use Laravel Mix.
MIT License
32 stars 12 forks source link

How to pass Configure variables from PHP --> JS #38

Closed impronta48 closed 2 years ago

impronta48 commented 2 years ago

Hi, is there a way to pass my configuration variables from PHP to JS? For example: application logo, email, url, etc Where should we store SPA configurations? (Like in .env files)

Thanks Massimo

ishanvyas22 commented 2 years ago

Hey @impronta48, you can create a dedicated API endpoint which returns a list of configuration variables that you require. This can be called from a component(i.e. Sidebar.vue, Header.vue, etc.), which can be used by other components. You can also cache this API endpoint according to your needs, since changes in these values are not very often.

There might be better way than this but this is what I would suggest.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

ishanvyas22 commented 2 years ago

Closing this issue due to inactivity. Please respond here if you want to reopen this.