Skip to content

Instantly share code, notes, and snippets.

@rhildred
Last active July 15, 2022 21:41
Show Gist options
  • Save rhildred/5a808a6c964d139ef3c66dc0334fc8b8 to your computer and use it in GitHub Desktop.
Save rhildred/5a808a6c964d139ef3c66dc0334fc8b8 to your computer and use it in GitHub Desktop.
How to install laravel 8 vue hello world app

To get Larval 8 running on Windows

  1. Use this article to install php and composer
  2. edit the php.ini file to uncomment fileinfo
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
  1. create the project composer create-project --prefer-dist laravel/laravel laravelvue
  2. open your project folder in vscode, start a terminal and run command composer require laravel/ui
  3. run php artisan ui vue
  4. run npm install
  5. run npm run dev it may prompt you to run twice
  6. run npm run watch (this makes mix use webpack to build app.js and app.css in the public folder). You will need to run this every time
  7. open another terminal and run php artisan serve. You will also need to run this each time.

To show that you can make and see changes

  1. Edit resources/view/welcome.blade.php to have the following contents:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
        <link href="css/app.css" rel="stylesheet" />
    </head>
    <body>
        <div id="app">
            <example-component />
        </div>        
        <script src="js/app.js"></script>
    </body>
</html>
  1. Edit resources/js/component/ExampleComponent.vue to include "Hello World":
<template>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">Hello World !! Example Component</div>

                    <div class="card-body">
                        I'm an example component.
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>
  1. Surf to http://localhost:8000

This should show your changed component. This Gist was inspired by this tutorial that had a couple of things missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment