Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build a new project with laravel

Shulou Source: shulou.com Published: 2022-06-03 08:47:20 10月02日 Update

This article focuses on "how to build a new project with laravel". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build a new project with laravel.

Method: 1, use the composer command to install laravel and "laravel/passport"; 3, use the "composer create-project-prefer-dist laravel/laravel project name" command to create a project.

The operating environment of this tutorial: windows7 system, Laravel5.5 version, Dell G3 computer.

Laravel5.5 New Project creation steps

Install laravel5.5

Install laravel5.5 using composer

Composer create-project-prefer-dist laravel/laravel=5.5.* laravel

Install laravel/passport

Because the laravel version is 5.5, you need to choose ~ 4.0 version.

Composer require laravel/passport=~4.0

There is a problem here. The random_compat version is locked to 9.99.99.

Installation request for paragonie/random_compat (locked at v9.99.99)-> satisfiable by paragonie/random_ Company [v9.99.99]

Solution: update random_compat version to ~ 2.0

Composer require paragonie/random_compat=~2.0composer require laravel/passport=~4.0

Modify the database configuration information. env file. I use homestead here, so I need to configure db_host to localhost and port to 33060.

Execute the database migration file in vagrant ssh, notice that there is a hole here, see the passport migration file in the / database/migrations directory, we don't care about it.

Php artisan migrate

Next we need to generate the passport key, where two keys are created and there will be a field distinction in the database, one is a private key that can be used in development, and the other is a password type key that can be used in production mode

Php artisan passport:install

Personally, it is suggested that we create whatever type of client we need.

Php artisan passport:client-password

For more information on how to use passprot, please refer to Passport OAuth authentication.

Create a Laravel project

Create a Laravel project composer create-project through Composer-- prefer-dist laravel/laravel myproject if you want to specify a version, change it to composer create-project-- prefer-dist laravel/laravel=5.5.* myproject can obtain the latest version of https://learnku.com/laravel through the laravel community

The creation process is a little slow, and you need to wait a while to successfully enter the project root directory myproject.

Generate the unique Key of the project, otherwise the project visit will report an error php artisan key:generate here. I believe you have a deeper understanding of "how to build a new project with laravel". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Project version data database file method configuration personal content command type learning generation utility deeper success next no interest can be passed through Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple Shulou Information Linux vpn