laravel: 使用laravel命令行laravel/installer

一,用composer安装laravel/installer

1,用composer安装

liuhongdi@lhdpc:/data/site/admin$ composer global require "laravel/installer"

2,查看laravel文件安装到了哪里?

liuhongdi@lhdpc:/data/site/admin$ ls -l /home/liuhongdi/.config/composer/vendor/laravel/installer/bin/laravel 
-rwxrwxr-x 1 liuhongdi liuhongdi 331  6月 19 00:43 /home/liuhongdi/.config/composer/vendor/laravel/installer/bin/laravel

二,把laravel命令加入到path环境变量,使可直接访问:

1,加入到/etc/profile

liuhongdi@lhdpc:/data/site/admin$ sudo vi /etc/profile

增加内容:

export PATH=/home/liuhongdi/.config/composer/vendor/laravel/installer/bin:$PATH

2,使修改生效

liuhongdi@lhdpc:/data/site/admin$ source /etc/profile

3,测试效果:

liuhongdi@lhdpc:/data/site/admin$ laravel --version
Laravel Installer 5.8.3

三,使用laravel命令:

1,查看帮助:

liuhongdi@lhdpc:/data/site/admin$ laravel --help
Description:
  List commands

Usage:
  list [options] [--] [<namespace>]

Arguments:
  namespace             The namespace name

Options:
      --raw             To output raw command list
......

2,列出命令:

liuhongdi@lhdpc:/data/site/admin$ laravel list
Laravel Installer 5.8.3

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  completion  Dump the shell completion script
  help        Display help for a command
  list        List commands
  new         Create a new Laravel application

3,新建一个laravel项目

liuhongdi@lhdpc:/data/site/admin$ laravel new gsadmin

   _                               _
  | |                             | |
  | |     __ _ _ __ __ ___   _____| |
  | |    / _` | '__/ _` \ \ / / _ \ |
  | |___| (_| | | | (_| |\ V /  __/ |
  |______\__,_|_|  \__,_| \_/ \___|_|


 ┌ Would you like to install a starter kit? ────────────────────┐
 │ No starter kit                                               │
 └──────────────────────────────────────────────────────────────┘

 ┌ Which testing framework do you prefer? ──────────────────────┐
 │ PHPUnit                                                      │
 └──────────────────────────────────────────────────────────────┘

 ┌ Would you like to initialize a Git repository? ──────────────┐
 │ No                                                           │
 └──────────────────────────────────────────────────────────────┘
...

安装完成后的选项:

   INFO  Application key set successfully.  

 ┌ Which database will your application use? ───────────────────┐
 │ MySQL                                                        │
 └──────────────────────────────────────────────────────────────┘

 ┌ Default database updated. Would you like to run the default database migrations? ┐
 │ No                                                                               │
 └──────────────────────────────────────────────────────────────────────────────────┘

 

posted @ 2024-07-29 10:33  刘宏缔的架构森林  阅读(156)  评论(0)    收藏  举报