【Win10开发环境】Laravel8 的几种用户认证服务扩展的安装

本文详细介绍了在Windows 10环境下,Laravel8 的多种用户认证服务扩展安装步骤,包括Laravel UI、Laravel-Admin 2.0、Laravel8 Breeze、Laravel Jetstream,涉及注册、登录、权限系统、数据库配置和前端资源编译等关键操作。
摘要由CSDN通过智能技术生成

1. 基础认证服务

1.1 Laravel UI 老式认证流程

Laravel UI 是一个从 Laravel 框架中分离出来的扩展包,Laravel 6 以前版本内置的基础用户认证服务,具备基本的用户认证流程,包括注册、登录、登出、密码重置、邮件验证等认证逻辑。以前的命令是make:auth。

  • composer 来安装 Laravel UI 包:
    composer require laravel/ui
PS D:\web_www\ui> composer require laravel/ui                                                         Using version ^3.4 for laravel/ui
./composer.json has been updated
Running composer update laravel/ui
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking laravel/ui (v3.4.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing laravel/ui (v3.4.5): Extracting archive
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/sail
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
77 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
No publishable resources for tag [laravel-assets].
Publishing complete.
  • 生成脚手架资源
    php artisan ui:auth
  • 配置数据库
    编辑.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ui
DB_USERNAME=ui
DB_PASSWORD=214521
  • 数据迁移(数据库初始化)
    php artisan migrate
PS D:\web_www\ui> php artisan migrate                                                                 Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (44.81ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (36.83ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (35.97ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (67.68ms)
  • 启动Laravel本地服务器
PS D:\web_www\ui> php artisan serve                                                                   Starting Laravel development server: http://127.0.0.1:8000
[Thu Mar 10 02:14:07 2022] PHP 7.4.3 Development Server (http://127.0.0.1:8000) started
  • 浏览器验证
    在这里插入图片描述
    在这里插入图片描述

1.2 Laravel-Admin 2.0 功能齐全的后台管理扩展包

laravel-admin 2.0 是基于laravel 7.*的版本和AdminLTE前端样式框架开发的一套通用后台管理系统laravel-admin:

  • 内置基于RBAC的权限系统
  • 菜单管理,和权限系统结合
  • 模型数据表格,能快速构建数据表格,并支持多种模型关系
  • 模型表单以及30+种form元素组件,自动实现增、删、改功能
  • 支持本地和云存储,支持图片的剪裁、压缩、加水印等操作
  • 大量常用后台开发组件

1.2.1 安装admin扩展包

composer require encore/laravel-admin:2.*

1.2.2 发布资源到项目里

php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"

1.2.3 .env配置数据库

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=admin
DB_USERNAME=admin
DB_PASSWORD=abcdddd

1.2.4 初始化数据

php artisan admin:install

1.2.5 启动本地服务器验证

php artisan serve
启动服务后,在浏览器打开 http://localhost/admin/ ,使用用户名 admin 和密码 admin登录
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

1.3 Laravel8 Breeze 入门套件

Breeze类似Laravel UI组件,具备基本的用户认证流程,包括注册、登录、登出、密码重置、邮件验证等认证逻辑。是Laravel 8认证入门套件,代替Laravel UI扩展。

1.3.1 安装Node.js环境

Node.js 是一个开源和跨平台的 JavaScript 运行时环境。 它几乎是任何类型项目的流行工具!Laravel8 的扩展需要Node.js环境支持。

  • Node Package Manager管理器

npm 以其简单的结构帮助 Node.js 生态系统蓬勃发展,现在 npm 仓库托管了超过 1,000,000 个开源包,你可以自由使用。

  • 下载Node.js最新版
    http://nodejs.cn/download/
  • 查询Node与Npm对应版本号
    https://nodejs.org/zh-cn/download/releases/

1.3.2 安装Breeze 扩展包

1.3.2.1 安装Breeze

composer require laravel/breeze --dev

PS D:\web_www> composer create-project laravel/laravel breeze                                         Creating a "laravel/laravel" project at "./breeze"
Info from https://repo.packagist.org: #StandWithUkraine
Installing laravel/laravel (v8.6.11)
  - Installing laravel/laravel (v8.6.11): Extracting archive
Created project in D:\web_www\breeze
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 110 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (v2.1.1)
  - Locking brick/math (0.9.3)
  - Locking dflydev/dot-access-data (v3.0.1)
  - Locking doctrine/inflector (2.0.4)
  - Locking doctrine/instantiator (1.4.1)
  - Locking doctrine/lexer (1.2.3)
  - Locking dragonmantank/cron-expression (v3.3.1)
  - Locking egulias/email-validator (2.1.25)
  - Locking facade/flare-client-php (1.9.1)
  - Locking facade/ignition (2.17.5)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fakerphp/faker (v1.19.0)
  - Locking filp/whoops (2.14.5)
  - Locking fruitcake/laravel-cors (v2.2.0)
  - Locking graham-campbell/result-type (v1.0.4)
  - Locking guzzlehttp/guzzle (7.4.1)
  - Locking guzzlehttp/promises (1.5.1)
  - Locking guzzlehttp/psr7 (2.1.0)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v8.83.4)
  - Locking laravel/sail (v1.13.6)
  - Locking laravel/sanctum (v2.14.2)
  - Locking laravel/serializable-closure (v1.1.1)
  - Locking laravel/tinker (v2.7.0)
  - Locking league/commonmark (2.2.3)
  - Locking league/config (v1.1.1)
  - Locking league/flysystem (1.1.9)
  - Locking league/mime-type-detection (1.9.0)
  - Locking mockery/mockery (1.5.0)
  - Locking monolog/monolog (2.3.5)
  - Locking myclabs/deep-copy (1.11.0)
  - Locking nesbot/carbon (2.57.0)
  - Locking nette/schema (v1.2.2)
  - Locking nette/utils (v3.2.7)
  - Locking nikic/php-parser (v4.13.2)
  - Locking nunomaduro/collision (v5.11.0)
  - Locking opis/closure (3.6.3)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.3.0)
  - Locking phpdocumentor/type-resolver (1.6.0)
  - Locking phpoption/phpoption (1.8.1)
  - Locking phpspec/prophecy (v1.15.0)
  - Locking phpunit/php-code-coverage (9.2.15)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.18)
  - Locking psr/container (1.1.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (1.1.4)
  - Locking psr/simple-cache (1.0.1)
  - Locking psy/psysh (v0.11.2)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.2.2)
  - Locking ramsey/uuid (4.2.3)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.6)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.3)
  - Locking sebastian/exporter (4.0.4)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (2.3.4)
  - Locking sebastian/version (3.0.2)
  - Locking swiftmailer/swiftmailer (v6.3.0)
  - Locking symfony/console (v5.4.5)
  - Locking symfony/css-selector (v5.4.3)
  - Locking symfony/deprecation-contracts (v2.5.0)
  - Locking symfony/error-handler (v5.4.3)
  - Locking symfony/event-dispatcher (v5.4.3)
  - Locking symfony/event-dispatcher-contracts (v2.5.0)
  - Locking symfony/finder (v5.4.3)
  - Locking symfony/http-foundation (v5.4.6)
  - Locking symfony/http-kernel (v5.4.6)
  - Locking symfony/mime (v5.4.3)
  - Locking symfony/polyfill-ctype (v1.25.0)
  - Locking symfony/polyfill-iconv (v1.25.0)
  - Locking symfony/polyfill-intl-grapheme (v1.25.0)
  - Locking symfony/polyfill-intl-idn (v1.25.0)
  - Locking symfony/polyfill-intl-normalizer (v1.25.0)
  - Locking symfony/polyfill-mbstring (v1.25.0)
  - Locking symfony/polyfill-php72 (v1.25.0)
  - Locking symfony/polyfill-php73 (v1.25.0)
  - Locking symfony/polyfill-php80 (v1.25.0)
  - Locking symfony/polyfill-php81 (v1.25.0)
  - Locking symfony/process (v5.4.5)
  - Locking symfony/routing (v5.4.3)
  - Locking symfony/service-contracts (v2.5.0)
  - Locking symfony/string (v5.4.3)
  - Locking symfony/translation (v5.4.6)
  - Locking symfony/translation-contracts (v2.5.0)
  - Locking symfony/var-dumper (v5.4.6)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.4)
  - Locking vlucas/phpdotenv (v5.4.1)
  - Locking voku/portable-ascii (1.6.1)
  - Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 110 installs, 0 updates, 0 removals
  - Installing doctrine/inflector (2.0.4): Extracting archive
  - Installing doctrine/lexer (1.2.3): Extracting archive
  - Installing symfony/polyfill-ctype (v1.25.0): Extracting archive
  - Installing webmozart/assert (1.10.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.3.1): Extracting archive
  - Installing symfony/polyfill-php80 (v1.25.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.25.0): Extracting archive
  - Installing symfony/var-dumper (v5.4.6): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.25.0<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值