Hey Guys, i have a general question since i currently go through the Vue.js Course but am at the beginning.
I have a existing laravel application (standard blade components etc, livewire). A friend of mine created an awesome page as a welcome page for me (it is more like a hobby project) and i wanted to implement it on my application. Since i have only backend knowledge i wonder if i can merge these technologies easily and what i have to consider. (Or will this be covered in the Vue Course, i didnt see it tho)
Yes, you can easily integrate Vue.js into your existing Laravel application. Here are the steps you can follow:
Install Vue.js: If you haven't already, you can install Vue.js by including the Vue.js library in your Laravel application. You can do this by adding the following script tag to your HTML layout file (usually located in the resources/views/layouts directory):
Create a Vue component: In your Laravel application, you can create a new Vue component by creating a new .vue file. For example, you can create a Welcome.vue file in the resources/js/components directory. In this file, you can define your Vue component using the Vue Single File Component syntax.
Register the Vue component: Once you have created your Vue component, you need to register it with Vue. You can do this by adding the following code to your main JavaScript file (usually located in the resources/js directory):
import Welcome from './components/Welcome.vue';
const app = new Vue({
el: '#app',
components: {
Welcome
}
});
Use the Vue component: Finally, you can use your Vue component in your Laravel blade templates. For example, you can add the following code to your blade template file:
<div id="app">
<welcome></welcome>
</div>
Make sure to replace welcome with the name of your Vue component.
That's it! Now you have successfully integrated Vue.js into your Laravel application. You can continue learning Vue.js and enhance your application with interactive frontend functionality.
I have a existing laravel application (standard blade components etc, livewire).
If you are already using Livewire, then continue to practice/learn it instead of using another thing like Vue. It will only cause more confusion for you.
To answer the title of this thread, you can install Laravel starter kits that will do the Vue scaffolding for you like laravel/ui and laravel/breeze there are other advanced starter kits but for you, those two are okay.
@NoLAstNamE Thank you! I integreted the design and Vue Page and it wasnt a hazzle. I will transform them into live-wire components as soon as i have time to have a clean application. Thank you
@shree083 Yes i used blade-components before but never used vue and wasnt so sure how this will interact with livewire and blade since you also use slots in vue and {{}} notation but it works just fine (like always in laravel)