Laravel在Windows下安装并生成第一个应用
中文文档参考:
官方文档:http://www.golaravel.com/laravel/docs/5.0/#install-composer
在Windows下安装:http://www.bitspedia.com/2014/09/how-to-install-and-make-first-laravel.html
原文如下:
I use Wamp on my Windows box for developing PHP based apps, I recently installed Laravel on my Windows box to test how to framework works and performs common tasks related to web development. I would keep posting good stuff I learned about Laravel in easy to follow steps for new developers of Laravel like me.
The Steps I followed are following:
- Laravel used Composer for dependency management, so first I installed Composer for Windows. Like to download is: https://getcomposer.org/Composer-Setup.exe
During the Composer installation, it would ask for the location of PHP.exe, so make sure you have installed PHP on your system before you install Composer. - It would download a few things from internet, so wait with patience. It uses SSL, so make sure SSL module is enabled in your php.ini file, just remove the “;” before the like: “extension=php_openssl.dll”. The php.ini file is located at your php’s installation home folder.The installation would also set the composer location into you windows path environmental variable, so that you can use composer command from Command Prompt.
- Download the Laravel Installer using Composer. On your Command Prompt, enter:
composer global require “laravel/installer=~1.1”
It would install all dependencies e.g. Symfony Console, Guzzlehttp Guzzle, Laravel Intaller, etc. - Add your ~/.composer/vendor/bin path into Path environmental variable, so that Windows Command Prompt could identify laravel command that would be used later to install Laravel and doing other tasks. In my case the path where its located is:
C:UsersUserNameAppDataRoamingComposervendorbin
so I added it into my Path environmental variable. Must restart your Shell or Command-Prompt so that updated Path variables is loaded. - Its time to create our first Laravel applications. For it, we need to install the Laravel itself. Afte you have done the above steps, its very simple. Issue following command at Command Prompt:
laravel new app-name
make sure your current directory is where you need your project to be created. In my case, I got following output by running the laravel new command:
D:OtherDataLaravelApps>laravel new addressbook Crafting application... Application ready! Build something amazing.
The addressbook folder contents looks like this:
The mail folder where our major web applications components would be located is “app”, its default structure is following:
原文写的挺好的,我这里就不一一翻译了
这里说下几个关键点:
如果你没法翻墙,就不要玩这个了!蛋疼 。
第一个下载:安装 Composer Windows 版本的
https://getcomposer.org/Composer-Setup.exe
安装过程中要你制定php.exe的目录,还有你要打开php的ssl扩展
第二步:
在cmd模式下运行:composer global require “laravel/installer=~1.1”
第三步:找到自己当前用户目录
C:UsersAdministratorAppDataRoamingComposervendorbin 把这个添加到环境变量PATH中
然后你在CMD目录下面切换到对应的目录安装就可以了!
E:wwwtest>laravel new blog
PS:Laravel 要推出5.1LTS了 值得花点时间学习!