Home > Article > PHP Framework > Laravel Lecture 1: Installing and running laravel
laravel is a simple and elegant php framework, and it is also the most popular php framework in the world. Therefore, for phper, it is a skill that must be learned.
Before installing lavarel, we need to solve the first question, how to pronounce the word lavarel? . Since this is not a real word, its correct pronunciation has never been consistent. But at present, most phpers in China pronounce this word as /['lɑːrvl]/.
Preparation before installation
lavarel has requirements for the PHP version. The 7.3 version I installed requires PHP version 7.2 or above. In addition, some PHP related extensions need to be enabled. If you are using a Windows system, you can use the wampserver software as a local PHP development environment. In addition, you can also use phpstudy as an integrated environment. phpstudy not only supports Windows systems, but also supports Linux systems.
In addition to the PHP version requirements, the composer tool is also required. Regarding how to install and use this tool, everyone can search and solve it by themselves.
Upgradecomposer
When I installed lavarel, a warning message appeared, saying that my composer version was too low, and asked me to download composer 2.0, and then I Follow the prompts and find the upgrade method.
composer self-update
composer2.0 is very good and can also support version rollback. You can use composer self-update --rollback to roll back to a previous version.
Install lavarel
It is recommended to use composer to install the lavavel framework.
1) First enter the cmd command window
2) Which directory do you want to install lavarel in, enter that directory
3) Run the command
composer create-project --prefer-dist laravel/laravel studylaravel
The --prefer-dist option is used here. The downloaded laravel does not contain the .git directory, which is more suitable for local development. In addition, there is no specific version number specified here, which means downloading the latest stable version of laravel. You can also choose the version you want to download, such as downloading the 6.* version
composer create-project --prefer-dist laravel/laravel abc 6.*
Run lavarel
in the lavarel project In the root directory, there is an artisan file. Through this file, we can run the lavarel framework without the help of the web server apache or nginx. Of course, I will explain how to deploy the lavarel project under nginx and apache in the future.
$ php artisan serve Laravel development server started: http://127.0.0.1:8000
When we are in command line mode, after the previous command, the lavarel project can run successfully. Check whether the project is running successfully by entering http://127.0.0.1:8000 in the browser.
The above is the detailed content of Laravel Lecture 1: Installing and running laravel. For more information, please follow other related articles on the PHP Chinese website!