上一课我们安装了官方的一个简易blog项目,该项目中已搭建了一个基本应用的结构,但在实际开发中,往往项目的结构并不是这样,今天这堂课我们从0开始新建一个项目,一切都是空白,真正从0开始
一: 安装laravel框架
- 新建项目文件夹tutorial
- 虚拟主机配置
- 建入口文件夹public和文件 index.php
- 修改homestead.yaml和host文件,工作环境为home,域名tutorial.app
putty登录虚拟机生成并配置composer.json 和 package.json文件
{ "name": "advance100/tutorial", "description": "有声有色出品laravel系列教程", "keywords": [ "framework", "laravel", "advance100", "tutorial", "laravel学习教程" ], "license": "MIT", "type": "project", "require": { "php": ">=7.0.0", "advance100/helper": "^2.0", "laravel/framework": "5.5.*" }, "require-dev": { }, "autoload": { "psr-4": { } }, "autoload-dev": { }, "extra": { "laravel": { "dont-discover": [] } }, "scripts": { }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true }, "repositories": { "hooks": { "type": "composer", "url": "https://larapack.io" } } }
{ "private": true, "scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "npm run watch -- --watch-poll", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.16.2", "bootstrap-sass": "^3.3.7", "cross-env": "^5.0.1", "jquery": "^3.1.1", "laravel-mix": "^1.0", "lodash": "^4.17.4", "vue": "^2.1.10" } }
- 安装laravel和laravel-mix
vagrant@homestead:~/abcde/study/tutorial$ composer config -g repo.packagist composer https://packagist.phpcomposer.com
vagrant@homestead:~/abcde/study/tutorial$ composer install