Rectangle 27 0

php Installing Laravel 4.1 in Windows 7 Make .phar file globally available to windows command line?


The link in this answer helped. But I had to run as an admin user in the command prompt to get it working.

installing laravel is easy way with composer, if you cant use composer, than you can go with laravel.phar file. This method is also easiest way to install laravel on your local machine.

Note
Rectangle 27 0

php Installing Laravel 4.1 in Windows 7 Make .phar file globally available to windows command line?


127.0.0.1             www.laravel.dev
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/laraveldev/public"
    ServerName www.laravel.dev
    ServerAlias www.laravel.dev
    ErrorLog "logs/laravel.log"
    CustomLog "logs/custom.laravel.log" combined
    <Directory "C:/xampp/htdocs/laraveldev/public">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
c:\windows\system32\drivers\etc
c:\xampp\htdocs\laraveldev
composer install
git clone git@github.com:laravel/laravel.git laraveldev
http://localhost/new_project/laravel/public/

Hi, I am new to Laravel, composer etc and I installed using method mentioned by @KLVTZ. What if I follow your advice! Will it conflict etc? More please.

I'm totally 100% sure you'll got those "You have arrived" text :D

If you use helper url's you won't have problems with routing without pretty url's.

It will download laravel into a folder name laraveldev in htdocs:

Restart you xampp apache. Then you can access laravel app in your browser like this:

The best way to install Laravel on windows is to use Git and Composer. if you already successfully install Git and Composer, open Git bash and using ls and cd terminal command go to c:\xampp\htdocs folder

The documentation on the Laravel website is not a good way to install laravel on windows. You'll got problem with the routing later.

This instruction is the only one that worked for me to get ride off the ugly URL. So yes, it work 100%

Use the Git bash terminal to install laravel into PHP using this command:

and put virtual hosts entry in c:\xampp\apache\conf\extra\httpd-vhosts.conf.

and run this command (it will ask you for your Git passphrase, make sure you install your Git properly - tutorial here - http://www.thegeekstuff.com/2012/02/git-for-windows/):

to get a better URL you must setup Apache Virtual Host and edit hosts file.

Note
Rectangle 27 0

php Installing Laravel 4.1 in Windows 7 Make .phar file globally available to windows command line?


@ECHO OFF
php "%~dp0laravel.phar" %*
C:\> cd wamp\www\new_project
C:\wamp\www\new_project\laravel\
composer create-project laravel/laravel --prefer-dist
http://localhost/new_project/laravel/public/

Based on the above question edit regarding making a .phar globally available for command:

Call the above statement in that new_project folder because that is where laravel will install. The above will make your directory path as:

Laravel is now available on your system. You can verify a successful install by going to:

Laravel uses composer to manage dependencies. Dependencies that update and change over time. What benefits are available over not installing via composer?

Make a new project directory: www\new_project. Now go to your start menu and run cmd as admin. Next you need to change your directory to the C drive and then into your www\new_project folder:

My Apologies. My Docs was set to 4.0 and not 4.1. Once you have laravel.phar file, just copy that over onto your project folder or www directory: C:/wamp/www/new_project/laravel.phar. By default, laravel.phar needs to be ran by PHP.exe on your cmd inside your project folder. To do so, you need to adjust your PATH variable -verify that you did it correctly: stackoverflow.com/questions/12870880/ Afterwards, you need to call "php laravel.phar new project"

Next, go to where your WAMP or XAMP project folder is -generally, this would be your www folder (i.e. C:\wamp\www).

Now you can take advantage of composer by calling:

Phar allows you to put an entire PHP application into a PHP Archive. It is not a direct executable as you may assume.

Thanks for you answer, but I'm specifically looking for the way of installation that is labeled "Via Laravel Installer" in the documentation, since it provides some benefits over the installation via composer. Basically what I want is, that I can start a new project by typing laravel new [name] in the command line.

Thanks, that worked if the laravel.phar file is in the same folder. But how do I go about this, if I want the laravel command to be globally available? I added the folder where the laravel.phar file is located to my path ( in my case C:\Windows\System32\laravel ), restarted the command line, but it does not work ( Could not open input file: laravel.phar ). The documentation suggests to move it into the usr/local/bin folder which obviously is not available on windows systems.

The "%*" repeats all of the arguments passed to the shell script. Thus, you can run 'laravel new project'. Hope this points you in the right direction.

The directory your looking for is C:\bin --the equivalent folder to /usr/bin on Linux. Copy the laravel.phar file in the C:\bin folder. Or , you can put it in a folder, such as, C:\php\laravel.phar. Then you need to make a batch file somewhere within the PATH called laravel.bat which will then do the following:

To install Laravel 4.1 successfully on Windows 7, you need Composer -a package manager. First install Composer. This will install globally on your system. Composer can now be called through your command prompt via 'composer'.

Note