laravel 12 安装配置

        安装 PHP(PHP 8.2.8)、composer(2.8.10)、laravel 12、node(v24.6.0)


        查看环境安装各版本:

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ php -v
PHP 8.2.29 (cli) (built: Jul  1 2025 20:19:51) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.29, Copyright (c) Zend Technologies

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ node -v
v24.6.0

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ npm -v
11.5.1

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ composer --version
Composer version 2.8.10 2025-07-10 19:08:33
PHP version 8.2.29 (D:\software\phpstudy_pro\Extensions\php\php8.2.29nts\php.exe)
Run the "diagnose" command to get more detailed diagnostics output.

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$

        laravel 安装好后,如何查看laravel安装版本:

在 Laravel 项目中,可以通过以下方法查看当前安装的版本:
方法1:使用 Artisan 命令(推荐)
	php artisan --version
	输出示例:Laravel Framework 11.8.1			(显示主版本号+子版本号)

方法2:查看 composer.json	
	cat composer.json | grep laravel/framework
	会显示类似:	"laravel/framework": "^11.0"

方法3:检查 Laravel 常量。在代码中调用:
	echo \Illuminate\Foundation\Application::VERSION;
	
方法4:通过 Composer 查看
	composer show laravel/framework
	输出中包含版本号及其他依赖信息


创建 Laravel 项目

        安装好 PHP 和 Composer 后,可以通过 Composer 的 create-project 命令创建一个新的 Laravel 项目:

composer create-project laravel/laravel example-app

        或者,你也可以通过 Composer 全局安装 Laravel Installer 来创建新的 Laravel 项目:

$ composer global require laravel/installer

$ laravel new www.laravelck.com


$ cd www.laravelck.com
$ composer run dev


ck@LAPTOP-HBHSMOI7 MINGW64 /d/web
$ composer global require laravel/installer
Changed current directory to C:/Users/ck/AppData/Roaming/Composer
./composer.json has been created
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 30 installs, 0 updates, 0 removals
  - Locking carbonphp/carbon-doctrine-types (3.2.0)
  - Locking doctrine/inflector (2.1.0)
  - Locking illuminate/collections (v12.25.0)
  - Locking illuminate/conditionable (v12.25.0)
  - Locking illuminate/contracts (v12.25.0)
  - Locking illuminate/filesystem (v12.25.0)
  - Locking illuminate/macroable (v12.25.0)
  - Locking illuminate/support (v12.25.0)
  - Locking laravel/installer (v5.17.0)
  - Locking laravel/prompts (v0.3.6)
  - Locking nesbot/carbon (3.10.2)
  - Locking psr/clock (1.0.0)
  - Locking psr/container (2.0.2)
  - Locking psr/simple-cache (3.0.0)
  - Locking symfony/clock (v7.3.0)
  - Locking symfony/console (v7.3.2)
  - Locking symfony/deprecation-contracts (v3.6.0)
  - Locking symfony/finder (v7.3.2)
  - Locking symfony/polyfill-ctype (v1.33.0)
  - Locking symfony/polyfill-intl-grapheme (v1.33.0)
  - Locking symfony/polyfill-intl-normalizer (v1.33.0)
  - Locking symfony/polyfill-mbstring (v1.33.0)
  - Locking symfony/polyfill-php83 (v1.33.0)
  - Locking symfony/polyfill-php84 (v1.33.0)
  - Locking symfony/process (v7.3.0)
  - Locking symfony/service-contracts (v3.6.0)
  - Locking symfony/string (v7.3.2)
  - Locking symfony/translation (v7.3.2)
  - Locking symfony/translation-contracts (v3.6.0)
  - Locking voku/portable-ascii (2.0.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 30 installs, 0 updates, 0 removals
  - Downloading doctrine/inflector (2.1.0)
  - Downloading symfony/polyfill-php84 (v1.33.0)
  - Downloading illuminate/macroable (v12.25.0)
  - Downloading psr/simple-cache (3.0.0)
  - Downloading psr/container (2.0.2)
  - Downloading illuminate/contracts (v12.25.0)
  - Downloading illuminate/conditionable (v12.25.0)
  - Downloading illuminate/collections (v12.25.0)
  - Downloading symfony/process (v7.3.0)
  - Downloading symfony/polyfill-mbstring (v1.33.0)
  - Downloading symfony/polyfill-intl-normalizer (v1.33.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.33.0)
  - Downloading symfony/polyfill-ctype (v1.33.0)
  - Downloading symfony/string (v7.3.2)
  - Downloading symfony/deprecation-contracts (v3.6.0)
  - Downloading symfony/service-contracts (v3.6.0)
  - Downloading symfony/console (v7.3.2)
  - Downloading laravel/prompts (v0.3.6)
  - Downloading voku/portable-ascii (2.0.3)
  - Downloading symfony/polyfill-php83 (v1.33.0)
  - Downloading symfony/translation-contracts (v3.6.0)
  - Downloading symfony/translation (v7.3.2)
  - Downloading psr/clock (1.0.0)
  - Downloading symfony/clock (v7.3.0)
  - Downloading carbonphp/carbon-doctrine-types (3.2.0)
  - Downloading nesbot/carbon (3.10.2)
  - Downloading illuminate/support (v12.25.0)
  - Downloading symfony/finder (v7.3.2)
  - Downloading illuminate/filesystem (v12.25.0)
  - Downloading laravel/installer (v5.17.0)
  - Installing doctrine/inflector (2.1.0): Extracting archive
  - Installing symfony/polyfill-php84 (v1.33.0): Extracting archive
  - Installing illuminate/macroable (v12.25.0): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing illuminate/contracts (v12.25.0): Extracting archive
  - Installing illuminate/conditionable (v12.25.0): Extracting archive
  - Installing illuminate/collections (v12.25.0): Extracting archive
  - Installing symfony/process (v7.3.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.33.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.33.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.33.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.33.0): Extracting archive
  - Installing symfony/string (v7.3.2): Extracting archive
  - Installing symfony/deprecation-contracts (v3.6.0): Extracting archive
  - Installing symfony/service-contracts (v3.6.0): Extracting archive
  - Installing symfony/console (v7.3.2): Extracting archive
  - Installing laravel/prompts (v0.3.6): Extracting archive
  - Installing voku/portable-ascii (2.0.3): Extracting archive
  - Installing symfony/polyfill-php83 (v1.33.0): Extracting archive
  - Installing symfony/translation-contracts (v3.6.0): Extracting archive
  - Installing symfony/translation (v7.3.2): Extracting archive
  - Installing psr/clock (1.0.0): Extracting archive
  - Installing symfony/clock (v7.3.0): Extracting archive
  - Installing carbonphp/carbon-doctrine-types (3.2.0): Extracting archive
  - Installing nesbot/carbon (3.10.2): Extracting archive
  - Installing illuminate/support (v12.25.0): Extracting archive
  - Installing symfony/finder (v7.3.2): Extracting archive
  - Installing illuminate/filesystem (v12.25.0): Extracting archive
  - Installing laravel/installer (v5.17.0): Extracting archive
22 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
19 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^5.17 for laravel/installer

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web
$ laravel new www.laravelck.com

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


 Which starter kit would you like to install? [None]:
  [none    ] None
  [react   ] React
  [vue     ] Vue
  [livewire] Livewire
 > None


 Which testing framework do you prefer? [Pest]:
  [0] Pest
  [1] PHPUnit
 > Pest

    Creating a "laravel/laravel" project at "./www.laravelck.com"
    Installing laravel/laravel (v12.3.0)
      - Downloading laravel/laravel (v12.3.0)
      - Installing laravel/laravel (v12.3.0): Extracting archive
    Created project in D:\web/www.laravelck.com
Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 112 installs, 0 updates, 0 removals
  - Locking brick/math (0.13.1)
  - Locking carbonphp/carbon-doctrine-types (3.2.0)
  - Locking dflydev/dot-access-data (v3.0.3)
  - Locking doctrine/inflector (2.1.0)
  - Locking doctrine/lexer (3.0.1)
  - Locking dragonmantank/cron-expression (v3.4.0)
  - Locking egulias/email-validator (4.0.4)
  - Locking fakerphp/faker (v1.24.1)
  - Locking filp/whoops (2.18.4)
  - Locking fruitcake/php-cors (v1.3.0)
  - Locking graham-campbell/result-type (v1.1.3)
  - Locking guzzlehttp/guzzle (7.9.3)
  - Locking guzzlehttp/promises (2.2.0)
  - Locking guzzlehttp/psr7 (2.7.1)
  - Locking guzzlehttp/uri-template (v1.0.4)
  - Locking hamcrest/hamcrest-php (v2.1.1)
  - Locking laravel/framework (v12.25.0)
  - Locking laravel/pail (v1.2.3)
  - Locking laravel/pint (v1.24.0)
  - Locking laravel/prompts (v0.3.6)
  - Locking laravel/sail (v1.44.0)
  - Locking laravel/serializable-closure (v2.0.4)
  - Locking laravel/tinker (v2.10.1)
  - Locking league/commonmark (2.7.1)
  - Locking league/config (v1.2.0)
  - Locking league/flysystem (3.30.0)
  - Locking league/flysystem-local (3.30.0)
  - Locking league/mime-type-detection (1.16.0)
  - Locking league/uri (7.5.1)
  - Locking league/uri-interfaces (7.5.0)
  - Locking mockery/mockery (1.6.12)
  - Locking monolog/monolog (3.9.0)
  - Locking myclabs/deep-copy (1.13.4)
  - Locking nesbot/carbon (3.10.2)
  - Locking nette/schema (v1.3.2)
  - Locking nette/utils (v4.0.8)
  - Locking nikic/php-parser (v5.6.1)
  - Locking nunomaduro/collision (v8.8.2)
  - Locking nunomaduro/termwind (v2.3.1)
  - Locking phar-io/manifest (2.0.4)
  - Locking phar-io/version (3.2.1)
  - Locking phpoption/phpoption (1.9.3)
  - Locking phpunit/php-code-coverage (11.0.10)
  - Locking phpunit/php-file-iterator (5.1.0)
  - Locking phpunit/php-invoker (5.0.1)
  - Locking phpunit/php-text-template (4.0.1)
  - Locking phpunit/php-timer (7.0.1)
  - Locking phpunit/phpunit (11.5.33)
  - Locking psr/clock (1.0.0)
  - Locking psr/container (2.0.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.3)
  - Locking psr/http-factory (1.1.0)
  - Locking psr/http-message (2.0)
  - Locking psr/log (3.0.2)
  - Locking psr/simple-cache (3.0.0)
  - Locking psy/psysh (v0.12.10)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (2.1.1)
  - Locking ramsey/uuid (4.9.0)
  - Locking sebastian/cli-parser (3.0.2)
  - Locking sebastian/code-unit (3.0.3)
  - Locking sebastian/code-unit-reverse-lookup (4.0.1)
  - Locking sebastian/comparator (6.3.2)
  - Locking sebastian/complexity (4.0.1)
  - Locking sebastian/diff (6.0.2)
  - Locking sebastian/environment (7.2.1)
  - Locking sebastian/exporter (6.3.0)
  - Locking sebastian/global-state (7.0.2)
  - Locking sebastian/lines-of-code (3.0.1)
  - Locking sebastian/object-enumerator (6.0.1)
  - Locking sebastian/object-reflector (4.0.1)
  - Locking sebastian/recursion-context (6.0.3)
  - Locking sebastian/type (5.1.3)
  - Locking sebastian/version (5.0.2)
  - Locking staabm/side-effects-detector (1.0.5)
  - Locking symfony/clock (v7.3.0)
  - Locking symfony/console (v7.3.2)
  - Locking symfony/css-selector (v7.3.0)
  - Locking symfony/deprecation-contracts (v3.6.0)
  - Locking symfony/error-handler (v7.3.2)
  - Locking symfony/event-dispatcher (v7.3.0)
  - Locking symfony/event-dispatcher-contracts (v3.6.0)
  - Locking symfony/finder (v7.3.2)
  - Locking symfony/http-foundation (v7.3.2)
  - Locking symfony/http-kernel (v7.3.2)
  - Locking symfony/mailer (v7.3.2)
  - Locking symfony/mime (v7.3.2)
  - Locking symfony/polyfill-ctype (v1.33.0)
  - Locking symfony/polyfill-intl-grapheme (v1.33.0)
  - Locking symfony/polyfill-intl-idn (v1.33.0)
  - Locking symfony/polyfill-intl-normalizer (v1.33.0)
  - Locking symfony/polyfill-mbstring (v1.33.0)
  - Locking symfony/polyfill-php80 (v1.33.0)
  - Locking symfony/polyfill-php83 (v1.33.0)
  - Locking symfony/polyfill-php84 (v1.33.0)
  - Locking symfony/polyfill-php85 (v1.33.0)
  - Locking symfony/polyfill-uuid (v1.33.0)
  - Locking symfony/process (v7.3.0)
  - Locking symfony/routing (v7.3.2)
  - Locking symfony/service-contracts (v3.6.0)
  - Locking symfony/string (v7.3.2)
  - Locking symfony/translation (v7.3.2)
  - Locking symfony/translation-contracts (v3.6.0)
  - Locking symfony/uid (v7.3.1)
  - Locking symfony/var-dumper (v7.3.2)
  - Locking symfony/yaml (v7.3.2)
  - Locking theseer/tokenizer (1.2.3)
  - Locking tijsverkoyen/css-to-inline-styles (v2.3.0)
  - Locking vlucas/phpdotenv (v5.6.2)
  - Locking voku/portable-ascii (2.0.3)
  - Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 112 installs, 0 updates, 0 removals
  - Downloading doctrine/lexer (3.0.1)
  - Downloading webmozart/assert (1.11.0)
  - Downloading dragonmantank/cron-expression (v3.4.0)
  - Downloading fakerphp/faker (v1.24.1)
  - Downloading symfony/http-foundation (v7.3.2)
  - Downloading fruitcake/php-cors (v1.3.0)
  - Downloading psr/http-message (2.0)
  - Downloading psr/http-client (1.0.3)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading psr/http-factory (1.1.0)
  - Downloading guzzlehttp/psr7 (2.7.1)
  - Downloading guzzlehttp/promises (2.2.0)
  - Downloading guzzlehttp/guzzle (7.9.3)
  - Downloading symfony/polyfill-php80 (v1.33.0)
  - Downloading guzzlehttp/uri-template (v1.0.4)
  - Downloading nunomaduro/termwind (v2.3.1)
  - Downloading phpoption/phpoption (1.9.3)
  - Downloading graham-campbell/result-type (v1.1.3)
  - Downloading vlucas/phpdotenv (v5.6.2)
  - Downloading symfony/css-selector (v7.3.0)
  - Downloading tijsverkoyen/css-to-inline-styles (v2.3.0)
  - Downloading symfony/var-dumper (v7.3.2)
  - Downloading symfony/polyfill-uuid (v1.33.0)
  - Downloading symfony/uid (v7.3.1)
  - Downloading symfony/routing (v7.3.2)
  - Downloading symfony/polyfill-php85 (v1.33.0)
  - Downloading symfony/polyfill-intl-idn (v1.33.0)
  - Downloading symfony/mime (v7.3.2)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v3.6.0)
  - Downloading symfony/event-dispatcher (v7.3.0)
  - Downloading psr/log (3.0.2)
  - Downloading egulias/email-validator (4.0.4)
  - Downloading symfony/mailer (v7.3.2)
  - Downloading symfony/error-handler (v7.3.2)
  - Downloading symfony/http-kernel (v7.3.2)
  - Downloading ramsey/collection (2.1.1)
  - Downloading brick/math (0.13.1)
  - Downloading ramsey/uuid (4.9.0)
  - Downloading monolog/monolog (3.9.0)
  - Downloading league/uri-interfaces (7.5.0)
  - Downloading league/uri (7.5.1)
  - Downloading league/mime-type-detection (1.16.0)
  - Downloading league/flysystem-local (3.30.0)
  - Downloading league/flysystem (3.30.0)
  - Downloading nette/utils (v4.0.8)
  - Downloading nette/schema (v1.3.2)
  - Downloading dflydev/dot-access-data (v3.0.3)
  - Downloading league/config (v1.2.0)
  - Downloading league/commonmark (2.7.1)
  - Downloading laravel/serializable-closure (v2.0.4)
      - Downloading laravel/framework (v12.25.0)
  - Downloading laravel/pail (v1.2.3)
  - Downloading laravel/pint (v1.24.0)
  - Downloading symfony/yaml (v7.3.2)
  - Downloading laravel/sail (v1.44.0)
  - Downloading nikic/php-parser (v5.6.1)
  - Downloading psy/psysh (v0.12.10)
  - Downloading laravel/tinker (v2.10.1)
  - Downloading hamcrest/hamcrest-php (v2.1.1)
  - Downloading mockery/mockery (1.6.12)
  - Downloading filp/whoops (2.18.4)
  - Downloading nunomaduro/collision (v8.8.2)
  - Downloading staabm/side-effects-detector (1.0.5)
  - Downloading sebastian/version (5.0.2)
  - Downloading sebastian/type (5.1.3)
  - Downloading sebastian/recursion-context (6.0.3)
  - Downloading sebastian/object-reflector (4.0.1)
  - Downloading sebastian/object-enumerator (6.0.1)
  - Downloading sebastian/global-state (7.0.2)
  - Downloading sebastian/exporter (6.3.0)
  - Downloading sebastian/environment (7.2.1)
  - Downloading sebastian/diff (6.0.2)
  - Downloading sebastian/comparator (6.3.2)
  - Downloading sebastian/code-unit (3.0.3)
  - Downloading sebastian/cli-parser (3.0.2)
  - Downloading phpunit/php-timer (7.0.1)
  - Downloading phpunit/php-text-template (4.0.1)
  - Downloading phpunit/php-invoker (5.0.1)
  - Downloading phpunit/php-file-iterator (5.1.0)
  - Downloading theseer/tokenizer (1.2.3)
  - Downloading sebastian/lines-of-code (3.0.1)
  - Downloading sebastian/complexity (4.0.1)
  - Downloading sebastian/code-unit-reverse-lookup (4.0.1)
  - Downloading phpunit/php-code-coverage (11.0.10)
  - Downloading phar-io/version (3.2.1)
  - Downloading phar-io/manifest (2.0.4)
  - Downloading myclabs/deep-copy (1.13.4)
  - Downloading phpunit/phpunit (11.5.33)
  - Installing doctrine/inflector (2.1.0): Extracting archive
      - Installing doctrine/lexer (3.0.1): Extracting archive
  - Installing symfony/polyfill-ctype (v1.33.0): Extracting archive
  - Installing webmozart/assert (1.11.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.4.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.6.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
      - Installing fakerphp/faker (v1.24.1): Extracting archive
  - Installing symfony/polyfill-php83 (v1.33.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.33.0): Extracting archive
  - Installing symfony/http-foundation (v7.3.2): Extracting archive
  - Installing fruitcake/php-cors (v1.3.0): Extracting archive
  - Installing psr/http-message (2.0): Extracting archive
  - Installing psr/http-client (1.0.3): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
      - Installing psr/http-factory (1.1.0): Extracting archive
  - Installing guzzlehttp/psr7 (2.7.1): Extracting archive
  - Installing guzzlehttp/promises (2.2.0): Extracting archive
  - Installing guzzlehttp/guzzle (7.9.3): Extracting archive
  - Installing symfony/polyfill-php80 (v1.33.0): Extracting archive
  - Installing guzzlehttp/uri-template (v1.0.4): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.33.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.33.0): Extracting archive
  - Installing symfony/string (v7.3.2): Extracting archive
  - Installing symfony/service-contracts (v3.6.0): Extracting archive
  - Installing symfony/console (v7.3.2): Extracting archive
  - Installing nunomaduro/termwind (v2.3.1): Extracting archive
  - Installing voku/portable-ascii (2.0.3): Extracting archive
  - Installing phpoption/phpoption (1.9.3): Extracting archive
  - Installing graham-campbell/result-type (v1.1.3): Extracting archive
  - Installing vlucas/phpdotenv (v5.6.2): Extracting archive
  - Installing symfony/css-selector (v7.3.0): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (v2.3.0): Extracting archive
  - Installing symfony/var-dumper (v7.3.2): Extracting archive
  - Installing symfony/polyfill-uuid (v1.33.0): Extracting archive
  - Installing symfony/uid (v7.3.1): Extracting archive
  - Installing symfony/routing (v7.3.2): Extracting archive
  - Installing symfony/process (v7.3.0): Extracting archive
  - Installing symfony/polyfill-php85 (v1.33.0): Extracting archive
  - Installing symfony/polyfill-php84 (v1.33.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.33.0): Extracting archive
  - Installing symfony/mime (v7.3.2): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.6.0): Extracting archive
  - Installing symfony/event-dispatcher (v7.3.0): Extracting archive
  - Installing psr/log (3.0.2): Extracting archive
  - Installing egulias/email-validator (4.0.4): Extracting archive
  - Installing symfony/mailer (v7.3.2): Extracting archive
  - Installing symfony/error-handler (v7.3.2): Extracting archive
  - Installing symfony/http-kernel (v7.3.2): Extracting archive
  - Installing symfony/finder (v7.3.2): Extracting archive
  - Installing ramsey/collection (2.1.1): Extracting archive
  - Installing brick/math (0.13.1): Extracting archive
  - Installing ramsey/uuid (4.9.0): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing symfony/translation-contracts (v3.6.0): Extracting archive
  - Installing symfony/translation (v7.3.2): Extracting archive
  - Installing psr/clock (1.0.0): Extracting archive
  - Installing symfony/clock (v7.3.0): Extracting archive
  - Installing carbonphp/carbon-doctrine-types (3.2.0): Extracting archive
  - Installing nesbot/carbon (3.10.2): Extracting archive
  - Installing monolog/monolog (3.9.0): Extracting archive
  - Installing league/uri-interfaces (7.5.0): Extracting archive
  - Installing league/uri (7.5.1): Extracting archive
  - Installing league/mime-type-detection (1.16.0): Extracting archive
  - Installing league/flysystem-local (3.30.0): Extracting archive
  - Installing league/flysystem (3.30.0): Extracting archive
  - Installing nette/utils (v4.0.8): Extracting archive
  - Installing nette/schema (v1.3.2): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.3): Extracting archive
  - Installing league/config (v1.2.0): Extracting archive
  - Installing league/commonmark (2.7.1): Extracting archive
  - Installing laravel/serializable-closure (v2.0.4): Extracting archive
  - Installing laravel/prompts (v0.3.6): Extracting archive
  - Installing laravel/framework (v12.25.0): Extracting archive
  - Installing laravel/pail (v1.2.3): Extracting archive
  - Installing laravel/pint (v1.24.0): Extracting archive
  - Installing symfony/yaml (v7.3.2): Extracting archive
  - Installing laravel/sail (v1.44.0): Extracting archive
  - Installing nikic/php-parser (v5.6.1): Extracting archive
  - Installing psy/psysh (v0.12.10): Extracting archive
  - Installing laravel/tinker (v2.10.1): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.1.1): Extracting archive
  - Installing mockery/mockery (1.6.12): Extracting archive
  - Installing filp/whoops (2.18.4): Extracting archive
  - Installing nunomaduro/collision (v8.8.2): Extracting archive
  - Installing staabm/side-effects-detector (1.0.5): Extracting archive
  - Installing sebastian/version (5.0.2): Extracting archive
  - Installing sebastian/type (5.1.3): Extracting archive
  - Installing sebastian/recursion-context (6.0.3): Extracting archive
  - Installing sebastian/object-reflector (4.0.1): Extracting archive
  - Installing sebastian/object-enumerator (6.0.1): Extracting archive
  - Installing sebastian/global-state (7.0.2): Extracting archive
  - Installing sebastian/exporter (6.3.0): Extracting archive
  - Installing sebastian/environment (7.2.1): Extracting archive
  - Installing sebastian/diff (6.0.2): Extracting archive
  - Installing sebastian/comparator (6.3.2): Extracting archive
  - Installing sebastian/code-unit (3.0.3): Extracting archive
  - Installing sebastian/cli-parser (3.0.2): Extracting archive
  - Installing phpunit/php-timer (7.0.1): Extracting archive
  - Installing phpunit/php-text-template (4.0.1): Extracting archive
  - Installing phpunit/php-invoker (5.0.1): Extracting archive
  - Installing phpunit/php-file-iterator (5.1.0): Extracting archive
  - Installing theseer/tokenizer (1.2.3): Extracting archive
  - Installing sebastian/lines-of-code (3.0.1): Extracting archive
  - Installing sebastian/complexity (4.0.1): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (4.0.1): Extracting archive
  - Installing phpunit/php-code-coverage (11.0.10): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.4): Extracting archive
  - Installing myclabs/deep-copy (1.13.4): Extracting archive
  - Installing phpunit/phpunit (11.5.33): Extracting archive
    64 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
    81 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
    No security vulnerability advisories found.
    > @php -r "file_exists('.env') || copy('.env.example', '.env');"

   INFO  Application key set successfully.


 Which database will your application use? [MySQL]:
  [mysql  ] MySQL
  [mariadb] MariaDB
  [sqlite ] SQLite (Missing PDO extension)
  [pgsql  ] PostgreSQL (Missing PDO extension)
  [sqlsrv ] SQL Server (Missing PDO extension)
 > MySQL


 Default database updated. Would you like to run the default database migrations? (yes/no) [yes]:
 > no

    ./composer.json has been updated
    Using version ^3.8 for pestphp/pest
    Using version ^3.2 for pestphp/pest-plugin-laravel
./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 14 installs, 0 updates, 0 removals
  - Locking brianium/paratest (v7.8.4)
  - Locking doctrine/deprecations (1.1.5)
  - Locking fidry/cpu-core-counter (1.3.0)
  - Locking jean85/pretty-package-versions (2.1.1)
  - Locking pestphp/pest (v3.8.3)
  - Locking pestphp/pest-plugin (v3.0.0)
  - Locking pestphp/pest-plugin-arch (v3.1.1)
  - Locking pestphp/pest-plugin-laravel (v3.2.0)
  - Locking pestphp/pest-plugin-mutate (v3.0.5)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.6.3)
  - Locking phpdocumentor/type-resolver (1.10.0)
  - Locking phpstan/phpdoc-parser (2.2.0)
  - Locking ta-tikoma/phpunit-architecture-test (0.8.5)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 14 installs, 0 updates, 0 removals
      - Downloading pestphp/pest-plugin (v3.0.0)
  - Downloading jean85/pretty-package-versions (2.1.1)
  - Downloading fidry/cpu-core-counter (1.3.0)
  - Downloading brianium/paratest (v7.8.4)
  - Downloading phpstan/phpdoc-parser (2.2.0)
  - Downloading phpdocumentor/reflection-common (2.2.0)
  - Downloading doctrine/deprecations (1.1.5)
  - Downloading phpdocumentor/type-resolver (1.10.0)
  - Downloading phpdocumentor/reflection-docblock (5.6.3)
  - Downloading ta-tikoma/phpunit-architecture-test (0.8.5)
  - Downloading pestphp/pest-plugin-arch (v3.1.1)
  - Downloading pestphp/pest-plugin-mutate (v3.0.5)
  - Downloading pestphp/pest (v3.8.3)
  - Downloading pestphp/pest-plugin-laravel (v3.2.0)
  - Installing pestphp/pest-plugin (v3.0.0): Extracting archive
      - Installing jean85/pretty-package-versions (2.1.1): Extracting archive
  - Installing fidry/cpu-core-counter (1.3.0): Extracting archive
  - Installing brianium/paratest (v7.8.4): Extracting archive
  - Installing phpstan/phpdoc-parser (2.2.0): Extracting archive
  - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
      - Installing doctrine/deprecations (1.1.5): Extracting archive
  - Installing phpdocumentor/type-resolver (1.10.0): Extracting archive
      - Installing phpdocumentor/reflection-docblock (5.6.3): Extracting archive
  - Installing ta-tikoma/phpunit-architecture-test (0.8.5): Extracting archive
  - Installing pestphp/pest-plugin-arch (v3.1.1): Extracting archive
  - Installing pestphp/pest-plugin-mutate (v3.0.5): Extracting archive
  - Installing pestphp/pest (v3.8.3): Extracting archive
  - Installing pestphp/pest-plugin-laravel (v3.2.0): Extracting archive
    Generating optimized autoload files
    > @php artisan config:clear

   INFO  Configuration cache cleared successfully.

    > @php artisan clear-compiled

   INFO  Compiled services and packages files removed successfully.

    > @php artisan package:discover --ansi

   INFO  Discovering packages.

  laravel/pail .................................................................................................. DONE
  laravel/sail .................................................................................................. DONE
  laravel/tinker ................................................................................................ DONE
  nesbot/carbon .................................................................................................     DONE
  nunomaduro/collision .......................................................................................... DONE
  nunomaduro/termwind ........................................................................................... DONE
  pestphp/pest-plugin-laravel ................................................................................... DONE

    88 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

   INFO  No publishable resources for tag [laravel-assets].

    No security vulnerability advisories found.

   INFO  Preparing tests directory.

      phpunit.xml ................................................................................... File already exists.
  tests/Pest.php ....................................................................................... File created.
  tests/TestCase.php ............................................................................ File already exists.
  tests/Unit/ExampleTest.php .................................................................... File already exists.
  tests/Feature/ExampleTest.php ................................................................. File already exists.

    ./composer.json has been updated
    Running composer update pestphp/pest-plugin-drift
Loading composer repositories with package information
    Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking pestphp/pest-plugin-drift (v3.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
      - Downloading pestphp/pest-plugin-drift (v3.0.0)
      - Installing pestphp/pest-plugin-drift (v3.0.0): Extracting archive
    Generating optimized autoload files
    > @php artisan config:clear

   INFO  Configuration cache cleared successfully.

    > @php artisan clear-compiled

   INFO  Compiled services and packages files removed successfully.

    > @php artisan package:discover --ansi

   INFO  Discovering packages.

  laravel/pail .................................................................................................. DONE
  laravel/sail .................................................................................................. DONE
  laravel/tinker     ................................................................................................ DONE
  nesbot/carbon ................................................................................................. DONE
  nunomaduro/collision .......................................................................................... DONE
  nunomaduro/termwind ...........................................................................................     DONE
  pestphp/pest-plugin-laravel ................................................................................... DONE

    89 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

   INFO  No publishable resources for tag [laravel-assets].

    No security vulnerability advisories found.
Using version ^3.0 for pestphp/pest-plugin-drift

  ✔✔

   INFO  The [tests\] directory has been migrated to PEST with 2 files changed.

    ./composer.json has been updated
    Running composer update pestphp/pest-plugin-drift
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 1 removal
  - Removing pestphp/pest-plugin-drift (v3.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
    Package operations: 0 installs, 0 updates, 1 removal
  - Removing pestphp/pest-plugin-drift (v3.0.0)
    Generating optimized autoload files
    > @php artisan config:clear

   INFO  Configuration cache cleared successfully.

    > @php artisan clear-compiled

   INFO  Compiled services and packages files removed successfully.

    > @php artisan package:discover --ansi

   INFO  Discovering packages.

  laravel/pail ..................................................................................................     DONE
  laravel/sail .................................................................................................. DONE
  laravel/tinker ................................................................................................ DONE
  nesbot/carbon .................................................................................................     DONE
  nunomaduro/collision .......................................................................................... DONE
  nunomaduro/termwind ........................................................................................... DONE
  pestphp/pest-plugin-laravel ................................................................................... DONE

    88 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

   INFO  No publishable resources for tag [laravel-assets].

    No security vulnerability advisories found.


 Would you like to run npm install and npm run build? (yes/no) [yes]:
 > yes


added 155 packages, and audited 156 packages in 31s

30 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> build
> vite build

    vite v7.1.3 building for production...
    transforming...
    ✓ 53 modules transformed.
rendering chunks...
computing gzip size...
public/build/manifest.json             0.31 kB │ gzip:  0.17 kB
public/build/assets/app-Dz1ORB9U.css  33.37 kB │ gzip:  8.48 kB
public/build/assets/app-C0G0cght.js   35.48 kB │ gzip: 14.21 kB
✓ built in 1.54s
   INFO  Application ready in [www.laravelck.com]. You can start your local development using:

➜ cd www.laravelck.com
➜ composer run dev

  New to Laravel? Check out our documentation. Build something amazing!


访问浏览器:http://127.0.0.1:8000/

报错:数据库连接错误

1)、修改env配置
	DB_CONNECTION=mysql
	DB_HOST=127.0.0.1
	DB_PORT=3306
	DB_DATABASE=laravel
	DB_USERNAME=root
	DB_PASSWORD=root
2)、迁移数据库
	ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
	$ php artisan migrate
	
		SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too
		long; max key length is 1000 bytes (Connection: mysql, SQL: alter table `users`
		add unique `users_email_unique`(`email`))

		  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:824
			820▕                     $this->getName(), $query, $this->prepareBindings($b
		indings), $e
			821▕                 );
			822▕             }
			823▕
		  ➜ 824▕             throw new QueryException(
			825▕                 $this->getName(), $query, $this->prepareBindings($bindi
		ngs), $e
			826▕             );
			827▕         }
			828▕     }

		  1   vendor\laravel\framework\src\Illuminate\Database\Connection.php:570
			  PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Sp
		ecified key was too long; max key length is 1000 bytes")

		  2   vendor\laravel\framework\src\Illuminate\Database\Connection.php:570
			  PDOStatement::execute()

		原因:报错,先删掉数据库的数据表
		然后在app/Providers/AppServiceProvider.php中添加;编辑app/Providers/AppServiceProvider.php:

			use Illuminate\Support\Facades\Schema;  
			public function boot() {     
				Schema::defaultStringLength(191); 
			} 

		重置数据库:

			php artisan migrate:fresh


再次迁移数据

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ php artisan migrate

   INFO  Preparing database.

  Creating migration table ............................................................................................................ 12.27ms DONE

   INFO  Running migrations.

  0001_01_01_000000_create_users_table ............................................................................................... 135.73ms DONE
  0001_01_01_000001_create_cache_table ................................................................................................. 8.63ms DONE
  0001_01_01_000002_create_jobs_table ................................................................................................. 36.15ms DONE


【服务器启动的4种方式】:

1)、再次启动服务

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ composer run dev
> Composer\Config::disableProcessTimeout
> npx concurrently -c "#93c5fd,#c4b5fd,#fdba74" "php artisan serve" "php artisan queue:listen --tries=1" "npm run dev" --names='server,queue,vite'
[queue]
[queue]    INFO  Processing jobs from the [default] queue.
[queue]
[vite]
[vite] > dev
[vite] > vite
[vite]
[server]
[server]    INFO  Server running on [http://127.0.0.1:8000].
[server]
[server]   Press Ctrl+C to stop the server
[server]
[vite]
[vite]   VITE v7.1.3  ready in 1107 ms
[vite]
[vite]   ➜  Local:   http://localhost:5173/
[vite]   ➜  Network: use --host to expose
[vite]
[vite]   LARAVEL v12.25.0  plugin v2.0.0
[vite]
[vite]   ➜  APP_URL: http://localhost:8000
[server]   2025-08-20 13:26:31 / .................................................................................. ~ 501.94ms
[server]   2025-08-20 13:26:35 /favicon.ico ......................................................................... ~ 0.44ms

再次访问浏览器:

        http://127.0.0.1:8000/      显示正常

        http://localhost:5173/      显示正常


                


2)、使用 php artisan serve

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ php artisan serve

冷暖自知一抹茶ck

冷暖自知一抹茶ck



3)、使用 小皮的nginx服务,创建一个网站,并添加伪静态

冷暖自知一抹茶ck   


添加伪静态

try_files $uri $uri/ /exploit/index.php?$query_string;if (!-e $request_filename) {
    rewrite  ^(.*)$  /index.php?s=$1  last;
    break;
}

访问虚拟域名:http://www.cklaravel.com/

冷暖自知一抹茶ck


4)、php内置服务器的初步使用:-S   指定一下地址和端口号  -t参数   指定一下根目录

ck@LAPTOP-HBHSMOI7 MINGW64 /d/web/www.laravelck.com
$ php -S localhost:8888 -t public
[Wed Aug 20 14:04:17 2025] PHP 8.2.29 Development Server (http://localhost:8888) started
[Wed Aug 20 14:04:26 2025] [::1]:58431 Accepted
[Wed Aug 20 14:04:26 2025] [::1]:58432 Accepted
[Wed Aug 20 14:04:26 2025] [::1]:58431 [200]: GET /
[Wed Aug 20 14:04:26 2025] [::1]:58431 Closing
[Wed Aug 20 14:04:26 2025] [::1]:58432 [200]: GET /build/assets/app-Dz1ORB9U.css
[Wed Aug 20 14:04:26 2025] [::1]:58434 Accepted
[Wed Aug 20 14:04:26 2025] [::1]:58434 [200]: GET /build/assets/app-C0G0cght.js
[Wed Aug 20 14:04:26 2025] [::1]:58432 Closing
[Wed Aug 20 14:04:26 2025] [::1]:58434 Closing
[Wed Aug 20 14:04:26 2025] [::1]:58436 Accepted
[Wed Aug 20 14:04:26 2025] [::1]:58436 [200]: GET /build/assets/app-C0G0cght.js
[Wed Aug 20 14:04:26 2025] [::1]:58436 Closing
[Wed Aug 20 14:04:29 2025] [::1]:58455 Accepted
[Wed Aug 20 14:04:29 2025] [::1]:58455 [200]: GET /favicon.ico
[Wed Aug 20 14:04:29 2025] [::1]:58455 Closing

访问浏览器:http://localhost:8888/ 

冷暖自知一抹茶ck




安装中间提示配置相关问题

【安装问题1】:
Which starter kit would you like to install? [None]:					#项目初始化的前端框架配置选项
  [none    ] None
  [react   ] React
  [vue     ] Vue
  [livewire] Livewire
 >
 
在安装 Laravel 时,系统会提示选择‌前端入门套件(starter kit)‌,这决定了项目初始化的前端框架配置选项。各选项含义如下:

1. ‌[none] None(默认)‌
	不安装任何前端套件,仅提供纯净的 Laravel 后端框架‌
	适合需要完全自定义前端或集成其他工具(如 Svelte、Angular)的场景。

2. ‌[react] React‌
	集成 React 框架及相关工具链(如 React Router、Vite)‌
	安装后自动生成基础组件和路由示例,适用于构建单页应用(SPA)‌

3. ‌[vue] Vue‌
	集成 Vue 3 及其生态系统(Vue Router、Pinia)‌
	提供预设组件和与 Laravel 后端的 API 通信配置,适合快速开发响应式界面。

4. ‌[livewire] Livewire‌
	使用 Laravel Livewire(服务端渲染组件库)替代传统 JavaScript 框架‌
	无需额外 Node.js 依赖,通过 PHP 逻辑直接驱动动态交互。

选择建议:
	‌新手或全栈项目‌:选 Vue 或 React 可快速搭建现代前端‌
	传统服务端渲染‌:Livewire 简化开发流程‌
	自定义架构‌:选 None 保留最大灵活性‌

选择后,系统自动配置对应依赖(如 npm install vue)并生成基础文件结构‌。
后续可通过 Artisan 命令调整配置(如 php artisan ui vue)‌ 



【安装问题2】:
 Which testing framework do you prefer? [Pest]:
  [0] Pest
  [1] PHPUnit
 > Pest

Laravel 新项目安装时会自动配置测试环境。询问您想使用哪种 PHP 测试框架

选项:‌
‌[0] Pest‌			 是 Laravel 官方推荐的现代测试框架(默认选项)
‌[1] PHPUnit"		 是 PHP 生态中使用最广泛的传统测试框架

选择建议‌:
	新手推荐 Pest‌:语法更简洁易读(按回车选择默认)
	现有项目迁移选 PHPUnit‌:如果团队已熟悉 PHPUnit
	大型企业项目可选 PHPUnit‌:需要更多自定义配置时
	
	
	
【安装问题3】:	
Which database will your application use? [MySQL]:
  [mysql  ] MySQL
  [mariadb] MariaDB
  [sqlite ] SQLite (Missing PDO extension)
  [pgsql  ] PostgreSQL (Missing PDO extension)
  [sqlsrv ] SQL Server (Missing PDO extension)
 > MySQL
	
在 Laravel 安装过程中出现的数据库选择提示,决定应用程序默认连接的数据库类型。



【安装问题4】:
 Default database updated. Would you like to run the default database migrations? (yes/no) [yes]:
 > no
默认数据库配置已更新。您想要运行默认的数据库迁移吗?(是/否) [默认是]:"‌

详细解释:
‌Default database updated‌
表示 Laravel 已经自动配置了默认的数据库连接设置(在 .env 文件中)

‌run the default database migrations‌
Laravel 自带一些预置的数据表迁移文件(用于创建用户表、密码重置表等)。选择 "yes" 会立即执行这些迁移:
	创建 users 用户表
	创建 password_reset_tokens 密码重置表
	创建 sessions 会话表
	创建 failed_jobs 失败任务表等
	
如何选择:
	按回车选择默认 [yes]‌:
		如果你的数据库已配置正确(.env 中的数据库用户名/密码正确),Laravel 会直接创建这些表。

	❌ ‌输入 no‌:
		如果你还未准备好数据库(例如数据库尚未创建),或者想稍后手动运行迁移。
		
后续操作建议:
1.确保数据库配置正确‌
	检查项目根目录的 .env 文件:	

	DB_CONNECTION=mysql
	DB_HOST=127.0.0.1
	DB_PORT=3306
	DB_DATABASE=laravel  # 你的数据库名
	DB_USERNAME=root     # 你的数据库用户名
	DB_PASSWORD=         # 你的数据库密码	
	
‌2. 如果选择 yes 后报错‌
	说明数据库连接配置有问题,需要修正 .env 中的配置,然后手动运行:
		php artisan migrate
		
		
		
【安装问题5】:		
 Would you like to run npm install and npm run build? (yes/no) [yes]:
 > yes
这是 Laravel 前端资源构建的提示,询问是否要自动安装 Node.js 依赖并编译前端资源(如 Vue/React 组件、CSS、JS 等)。以下是详细说明:
‌
1.npm install‌
	自动安装 package.json 中定义的所有前端依赖(如 vite、vue、tailwindcss 等)到 node_modules 目录。

2.‌npm run build‌
	根据 vite.config.js 或 webpack.mix.js 配置,编译和压缩前端资源(如将 .vue 文件转为浏览器可运行的 .js,压缩 CSS 等),输出到 public/build 目录。

‌3. [yes] 默认选项‌
	直接按回车会执行这两个命令,推荐大多数用户选择。




参考连接:

        官方文档:https://laravel.com/docs/11.x/installation 

        中文文档: Lararvel 11 中文文档Laravel



        Laravel windows 环境 配置 安装 Laravel 11 新手安装

        Laravel 11 框架创建与创建遇到的问题

        laravel伪静态配置




冷暖自知一抹茶ck
请先登录后发表评论
  • 最新评论
  • 总共0条评论