项目作者: ruhel241

项目描述 :
Laravel & React boilerplate. (Laravel version 7.x)
高级语言: PHP
项目地址: git://github.com/ruhel241/laravel-react-boilerplate.git
创建时间: 2020-07-07T11:08:36Z
项目社区:https://github.com/ruhel241/laravel-react-boilerplate

开源协议:

下载




Laravel & React boilerplate

Project setup

Install node_modules.

  1. npm install

Install Laravel Composer in your project folder, command in your terminal.

  1. composer install

Create .env file just command in your terminal:

  1. cp .env.example .env

Laravel key:Generate in your project

  1. php artisan key:generate

Navigate your project then command in your terminal:

  1. php artisan serve

Compiles and reloads for development

  1. npm run watch or npm run dev

Happy Coding :)

Compiles and minifies for production

  1. npm run prod or npm run production (build your site)

After build your site then Remove

  1. * node_modules,
  2. * package-lock.json,
  3. * js folder in your resources folder,
  4. * sass folder in your resources folder

Or Menually set Laravel & React Documentation

Installation Laravel

Install Laravel Project

  1. composer create-project --prefer-dist laravel/laravel myProject

Navigate your project

  1. * cd myProject
  2. * php artisan serve

Check laravel properly install, you can show your browser.

Installation React

Navigate your project then command in your terminal:

  1. composer require laravel/ui

npm install && npm run dev to compile your fresh scaffolding

  1. npm install or npm i
  2. npm run dev

Generate basic scaffolding…

  1. php artisan ui react

Generate login / registration scaffolding…

  1. php artisan ui react --auth

Check your myProject folder, go to resources folder then you can see components folder and files..

Compiles and reloads for development

  1. npm install
  2. npm run dev

React integrate in your laravel blade file

  1. * set <div id="example"></div> in your welcome.blade.php body
  2. * load script <script src="/js/app.js"></script>
  3. * load CSS <link href="/css/app.css" rel="stylesheet">
  4. * You can see your browser, there is Loading React Component

Navigate your project then command in your terminal:

  1. cd myProject
  2. php artisan serve
  3. npm run watch or npm run dev

Happy Laravel & React Coding :-)