• Stars
    star
    848
  • Rank 53,754 (Top 2 %)
  • Language
    PHP
  • Created over 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Example project using Vue CLI 3 with Laravel

Laravel + Vue CLI 3

This demo assumes you are serving this Laravel app via Valet at laracon.test. If you are serving the laravel app at a different local URL, modify it accordingly in frontend/vue.config.js.

To Run the Frontend

cd frontend
yarn # OR npm install
yarn serve # OR npm run serve

# build for production:
yarn build # OR npm run build

Steps for Scaffolding From Scratch

  1. Create Laravel Project

    laravel new my-project
    cd my-project
    
    # remove existing frontend scaffold
    rm -rf package.json webpack.mix.js yarn.lock resources/assets
  2. Create a Vue CLI 3 project in the Laravel app

    vue create frontend
    # pick router
  3. Configure Vue project

    Create frontend/vue.config.js:

    module.exports = {
      // proxy API requests to Valet during development
      devServer: {
        proxy: 'http://laracon.test'
      },
    
      // output built static files to Laravel's public dir.
      // note the "build" script in package.json needs to be modified as well.
      outputDir: '../public',
    
      // modify the location of the generated HTML file.
      // make sure to do this only in production.
      indexPath: process.env.NODE_ENV === 'production'
        ? '../resources/views/index.blade.php'
        : 'index.html'
    }

    Edit frontend/package.json:

    "scripts": {
      "serve": "vue-cli-service serve",
    - "build": "vue-cli-service build",
    + "build": "rm -rf ../public/{js,css,img} && vue-cli-service build --no-clean",
      "lint": "vue-cli-service lint"
    },
  4. Configure Laravel for single-page app.

    routes/web.php

    <?php
    
    Route::get('/{any}', 'SpaController@index')->where('any', '.*');

    app/Http/Controllers/SpaController.php

    <?php
    
    namespace App\Http\Controllers;
    
    use Illuminate\Http\Request;
    
    class SpaController extends Controller
    {
        public function index()
        {
            return view('index');
        }
    }

More Repositories

1

build-your-own-mint

Build your own personal finance analytics using Plaid, Google Sheets and CircleCI.
HTML
2,481
star
2

vue-hooks

Experimental React hooks implementation in Vue
JavaScript
1,595
star
3

pod

Git push deploy for Node.js
JavaScript
1,343
star
4

zoomerang

drop in zoom anything
JavaScript
1,221
star
5

vue-lit

Proof of concept custom elements "framework"
JavaScript
1,109
star
6

HTML5-Clear-v2

HTML5 Clear version 2
JavaScript
948
star
7

vite-vs-next-turbo-hmr

Benchmarking Vite vs. Next + turbopack HMR performance
JavaScript
920
star
8

HTML5-Clear

[DEPRECATED] A replica of the Clear iphone app in HTML5
JavaScript
719
star
9

register-service-worker

A script to simplify service worker registration with hooks for common events.
JavaScript
640
star
10

vue-wordle

Wordle built with Vue, aka VVordle
TypeScript
584
star
11

launch-editor

Open file in editor from Node.js.
JavaScript
577
star
12

vue-svelte-size-analysis

Comparing generated code size of Vue and Svelte components
JavaScript
305
star
13

semi

To semicolon or not to semicolon; that is the question
JavaScript
304
star
14

okie

Dead simple worker threads pool
TypeScript
263
star
15

starz

Count a GitHub user's total stars
JavaScript
145
star
16

circular-json-es6

circular JSON.stringify and JSON.parse, for environments with native ES6 Map
JavaScript
129
star
17

pug-plain-loader

webpack loader that transforms pug templates to plain HTML
JavaScript
116
star
18

release-tag

GitHub action for auto creating a release on tag push
JavaScript
109
star
19

Speech.js

Simple wrapper for Chrome's web speech recognition API
JavaScript
97
star
20

retweeter

Auto retweet from another account using CircleCI scheduled workflows
JavaScript
59
star
21

matrix.js

Featherweight CSS3 3D engine
JavaScript
58
star
22

buble

a fork of buble with some vue-specific hacks, used in vue-template-es2015-compiler
JavaScript
55
star
23

nightwatch-helpers

custom assertions and commands for easier nightwatch tests
JavaScript
53
star
24

shell-task

Proof-of-concept then-able shell commands in node.
JavaScript
46
star
25

creative-html5

A class about JavaScript, html5 and creative coding.
JavaScript
46
star
26

vue-template-explorer

See how vue templates get compiled into render functions under the hood
Vue
45
star
27

QR.js

Simple HTML5 Canvas-based QR Code generation
JavaScript
42
star
28

vue-tsc-3.3-type-repro

Vue
38
star
29

material-color-scheme-es6

Material Theme color scheme tweaked for ES6
JavaScript
32
star
30

semi-sublime

Sublime Text 3 plugin for Semi
Python
32
star
31

vite-pre-transform-test

JavaScript
30
star
32

speech

component for Chrome speech recognition wrapper
JavaScript
29
star
33

webpack-hmr-repro

JavaScript
28
star
34

raveal

Radially reveal an element
JavaScript
27
star
35

cjs-module-lexer-rollup-reexports

JavaScript
26
star
36

roetem

meteor-like experiment with vue and rethinkdb
JavaScript
24
star
37

gulp-component

component plugin for gulp
JavaScript
22
star
38

oxc-node-loader

JavaScript
22
star
39

tucao

吐槽专用
21
star
40

thread-loader-bug

JavaScript
21
star
41

rollup-tostringtag-symbol-conflict

JavaScript
20
star
42

resolve-type-test

TypeScript
20
star
43

browser-audio

Simple cross browser audio player
JavaScript
19
star
44

babel-preset-flow-vue

JavaScript
18
star
45

esbuild-exports-signature-repro

JavaScript
17
star
46

popSlides

javascript popup slideshow plugin based on jQuery
JavaScript
17
star
47

vue

vue bug
HTML
16
star
48

rollup-commonjs-bug

JavaScript
15
star
49

Puzzle-Demo

A slider puzzle game with CSS3 transitions.
JavaScript
14
star
50

capper

Capture canvas animations.
JavaScript
12
star
51

Socket-Play

iPhone-controlled HTML5 game concept demo
JavaScript
12
star
52

Kinect-Keylight

Kinect version of @hakimel 's Keylight
C++
11
star
53

showme

show me the code (for an npm package)
JavaScript
11
star
54

workerify

Component for easy inline web worker
JavaScript
10
star
55

de-indent

remove extra indent from a block of code
JavaScript
10
star
56

new

Scaffold a new project.
JavaScript
8
star
57

Telekinesis

User gesture input simulation.
JavaScript
8
star
58

whipcream

Chai-style chaining sugar for webdriverjs
JavaScript
8
star
59

babel-plugin-transform-es2015-classes-simple

JavaScript
7
star
60

emitter-fsm

EventEmitter based finite state machine
JavaScript
6
star
61

rolldown-dce-repro

JavaScript
5
star
62

templates

Personal project scaffolding templates
JavaScript
5
star
63

choreo.js

Event-based flow control for interactive walkthroughs
JavaScript
4
star
64

gulp-jscoverage

JSCoverage instrumentation plugin for gulp
JavaScript
4
star
65

fancytext

Text with fancy transitions
JavaScript
4
star
66

roller

One-dimensional touch scroller with momentum and elastic pagination
JavaScript
4
star
67

test-cli-preset

JavaScript
4
star
68

gruntfile-yaml

write grunt config in yaml.
JavaScript
4
star
69

generator-extension

A Chrome extension generator
JavaScript
3
star
70

blaze-local-state

Local reactive state for Blaze templates
JavaScript
3
star
71

generator-dude

A personal Yeoman generator
JavaScript
3
star
72

tester

webhook tests.
JavaScript
2
star
73

gulp-component-updater

Gulp-friendly module to auto add/delete files in your component.json
JavaScript
2
star
74

grunt-component-add

Automatically add files to component.json
JavaScript
1
star