Install Laravel using Composer in Windows (phpStudy2016 integrated with the php environment ),

Source: Internet
Author: User
Tags composer install

Install Laravel using Composer in Windows (phpStudy2016 integrated with the php environment ),

Description: Go to the official website to learn about the required php version and install it based on the required version number.
Chinese site: http://www.golaravel.com/
Https://laravel.com/
In fact, the installation steps are the same, but the php extensions required for different php versions are different (note ).
First install phpStudy2016. This step is to install laravel 4.0.

FirstInstall Composer
Windows Latest Version Composer download: Composer-Setup.exe (https://getcomposer.org /). After the installation is complete, if the installation/update of the Composer installation package is slow, you can use a domestic image to install and upgrade the package dependency, for details, refer to this article Composer China full image (https://pkg.phpcomposer.com /). Select the php version corresponding to your laravel version in the prompt box.

Second, Configure the system path
To use the composercommand on the console, configure the directory of the executable file (.exe/. bat) of composerand PHP to the Path of the system environment variable. Phpfor php.exe in phpStudy installation directory to find here is php5.3: D: \ phpStudy \ php \ php-5.3.29-nts/php.exe, Composer installation now the Installation File environment is configured. You do not need to configure php and composer separately.
Use Composer to install Laravel
After completing the above preparations, we will officially start to install the new Laravel application. First, install Laravel directly through Composer.
Cd/your installation directory. In this directory, run the following Composer command:
Disable php extension xdebug before an error is reported.

Third, Installation
Laravel 4.0 installation command: composer create-project laravel/laravel -- prefer-dist.
If it gets stuck, you need to replace it with a composer image in China:
Method 1: It is recommended to modify the global configuration file of composer.
Composer config-g repo. packagist composer https://packagist.phpcomposer.com
Method 2: Modify the composer. json configuration file of the current project:
Composer config repo. packagist composer https://packagist.phpcomposer.com
Go to the root directory of your project (that is, the directory where the composer. json file is located) and run the following command:
The above command will automatically add the image configuration information at the end of the composer. json file in the current project (you can also manually add it ):
"Repositories ":{
"Packagist ":{
"Type": "composer ",
"Url": "https://packagist.phpcomposer.com"
}
}
Take the composer. json configuration file of the laravel project as an example. Execute the preceding command as follows (note the last few lines ):

{  "name": "laravel/laravel",  "description": "The Laravel Framework.",  "keywords": ["framework", "laravel"],  "license": "MIT",  "type": "project",  "require": {  "php": ">=5.5.9",  "laravel/framework": "5.2.*"  },  "config": {  "preferred-install": "dist"  },  "repositories": {  "packagist": {  "type": "composer",  "url": "https://packagist.phpcomposer.com"  }  }  }

Fourth, Error handling:
Sometimes the following error occurs when composer install/update:
The solution is to set a local or global composer Configuration:

Composer config secure-http false
Global settings:
Composer config-g secure-http false
It means that https requests are disabled by default.
Install the specified version
Composer create-project laravel/laravel = 5. 0. * -- prefer-dist
Or
Composer create-project laravel/laravel = 5. 0. * demo -- prefer-dist
Update Composer
Composer self-update

Access the web address to laravel/public/and define this directory as the web Access Directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.