In general, the idea is to decouple these solutions not the other way around. Perhaps you could write a package (npm/composer) to meet your needs.
Tighter Coupling between Laravel (PHP) and Vue (JS)
I've been building a fairly large project for the past year, starting as almost purely PHP-based backend coding, moving to Blade-based frontend work, and now moving to Vue. I've been migrating a lot of my Blade Views to Vue Single File Components...
During all of this, one of my major annoyances has been with how much work I'm having to repeat just to get the things that are already working in PHP => Blade to work in Vue... So I've been thinking - how much work has been done in developing tools and systems to better couple things from Laravel into Vue? There are several things that I can imagine being extremely useful but haven't been built yet (or which I haven't found, at least...) So I'm asking - does any of this exist today, and (if not) which of these things are most interesting to people out there to use once I sit down and start writing these extensions myself?
- A way for components to "natively" export things directly to Vue.
... say something like return view('category.blog.index')->withVue(['articles' => $articles]);, which would be able to pass 'articles' in as a Vue component prop...
- A way for Vue-Router to understand Laravel's route definitions.
... maybe adding notation/syntax to Laravel's route files so that Vue-Router doesn't need any configuration files of its own...
- Eloquent in Vue
... This is a big one, of course, but shouldn't be too difficult if one is okay with this being done server-side in a separate process. Would reduce the need for APIs and Axios and VueX for so many of the 'smaller' things we do.
- Javascript (Node) jobs in Laravel's job worker
... Again, not too difficult if you're okay with something like $schedule->exec('node /var/www/scripts/maint/backup.js')->daily();, but a tighter integration should be possible...
... These are just a handful of examples that I've been thinking about of late, but something that I believe would come in very handy for people wanting to implement Vue (or expand Vue's presence on their site) but who don't have much Javascript experience... What do you think?
Please or to participate in this conversation.