安装
安装软件
Composer
composer config --list --global
清理缓存
composer clear
更新
composer update
nodejs
apt remove -y nodejs npm
apt autoremove -y
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
node -v # 期望 v22.x
npm -v # 期望 10.x+
which -a node npm
Laravel
安装laravel
composer global require laravel/installer
等待提示
00 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
00 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^0.00 for laravel/installer
linux 系统添加PATH全局路径
ls -l /root/.config/composer/vendor/bin
echo 'export PATH="$PATH:/root/.config/composer/vendor/bin"' >> ~/.bashrc
echo 'export COMPOSER_ALLOW_SUPERUSER=1' >> ~/.bashrc
source ~/.bashrc
查看版本
laravel --version
提示Laravel Installer 0.0.0
laravel new <项目文件夹>
laravel new example-app
你想使用入门套件吗
Do you want to use a starter kit? (yes/no) [no]:
> no
你想用哪种前端技术栈来开发
Which frontend stack do you want to build on? [Blade]:
[blade ] Blade
[react ] React
[svelte ] Svelte
[vue ] Vue
[livewire] Livewire
> React
等待 88/88 [===========================>] 100%
你更喜欢哪个身份验证提供商
Which authentication provider do you prefer? [Laravel's built-in authentication]:
[laravel] Laravel's built-in authentication
[workos ] WorkOS (Requires WorkOS account)
[none ] No authentication scaffolding
> laravsel
你想在你的应用中添加Teams支持吗
Would you like to add teams support to your application? (yes/no) [no]:
> yes
你更喜欢用哪个测试框架
Which testing framework do you prefer? [Pest]:
[0] Pest
[1] PHPUnit
> 0
你想安装 Laravel Boost 来提升 AI 辅助编程吗
Do you want to install Laravel Boost to improve AI assisted coding? (yes/no) [yes]:
> no
等待
等待安装
Would you like to run npm install --ignore-scripts and npm run build? (yes/no) [yes]:
> yes
等待提示
✓ built in 4.82s
INFO Application ready in [laravel]. You can start your local development using:
➜ cd laravel
➜ composer run dev
New to Laravel? Check out our documentation. Build something amazing!
nodejs
cd <项目文件夹>
配置镜像源
npm config set registry https://registry.npmmirror.com
查看配置
npm config get registry
编译前端
npm install && npm run build
安装插件
npx shadcn@latest add --all
√ The file alert/AlertDescription.vue already exists. Would you like to overwrite? ... yes
√ The file button/Button.vue already exists. Would you like to overwrite? ... yes
√ The file dropdown-menu/DropdownMenuSubTrigger.vue already exists. Would you like to overwrite? ... yes
√ The file navigation-menu/NavigationMenuLink.vue already exists. Would you like to overwrite? ... yes
√ The file sonner/Sonner.vue already exists. Would you like to overwrite? ... yes
√ The file sonner/index.ts already exists. Would you like to overwrite? ... yes
√ The file dialog/DialogFooter.vue already exists. Would you like to overwrite? ... yes
√ The file sidebar/SidebarMenuButtonChild.vue already exists. Would you like to overwrite? ... yes
√ The file sidebar/SidebarMenuSubButton.vue already exists. Would you like to overwrite? ... yes
√ The file sidebar/SidebarRail.vue already exists. Would you like to overwrite? ... yes
√ The file sidebar/SidebarTrigger.vue already exists. Would you like to overwrite? ... yes
√ The file sidebar/utils.ts already exists. Would you like to overwrite? ... yes
composer run dev
安装 Laravel Breeze
composer require laravel/breeze
安装前端
npm install
#监听实时更新,关闭终端就停止更新,需要按ctrl+c
npm run dev
#构建
npm run buil
更新laravel
composer global update laravel/installer
Would you like to update now? (yes/no) [yes]:
> yes
查看
composer global show
composer global show laravel/installer
卸载
composer global remove laravel/installer
sudo chown -R www-data:www-data ./example/
sudo chmod 777 ./example/