Laravel installation withouth vagrant - php

Is it possible to install Laravel Framework withouth installing vagrant first?
I just read about vagrant and seems just great, however I think I will skip it for now.
I "installed" Laravel through composer, but when I tried to use the Laravel command:
new <app-name>
The console outputs:
laravel command not found.
I already set the ~/.composer/vendor/bin route to the $PATH

In your ~/.profile file you should have something like this if you are using a mac
export PATH="~/.composer/vendor/bin:${PATH}"
If you are using Ubuntu you should have something like this in your ~/.profile file
PATH="~/.composer/vendor/bin:$PATH"
Finally, if you haven't installed the CLI tool for the Laravel Installer just run this code in the terminal
composer global require "laravel/installer=~1.1"

You need to install laravel in order to use it.
Use composer global require "laravel/installer=~1.1" to install laravel

Related

Cannot find ~/.composer folder after installing composer

I have installed composer by the instructions given in their site for Ubuntu 16.04. Its giving the usual output after giving the 'composer' command in the terminal.
After installing composer, I have downloaded the composer using
composer global require "laravel/installer"
Now to install Laravel, I have to add $HOME/.composer/vendor/bin in my path. But there is no .composer folder in my home directory. Can anybody tell me why this is happening ?
In my Ubuntu 16.04.4, after downloading the Laravel installer using
composer global require "laravel/installer"
I found my Laravel here :
~/.config/composer/vendor/laravel/installer/
Then I set my .bashrc using nano ~/.bashrc and export your composer config file :
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
And refresh using source ~/.bashrc in terminal
And Laravel is running, but I did not need any .composer folder as said in the Laravel official site.
This answer has helped me a lot.

Using Laravel 5.4 in PhpStorm

Am trying to configure my PhpStorm to use Laravel 5.4 but don't know how to go about it. I have composer installed globally. And this are the steps I have already taken.
1.Go to Settings -> Languages & Frameworks -> PHP -> Composer
Set the composer.phar path to C:\ProgramData\ComposerSetup\bin\composer.phar
but am unable to locate the PATH to COMPOSER.JSON.
Who can give me the steps to configuring Laravel in PhpStorm.
Am using XAMPP
Reinstall composer and check that the PHP path is correct, if you run composer in the terminal you should see this do something, if not it is not installed correctly, similarly if you run php -v this will show the PHP version.
In your Laravel directory there should be a composer.json file, if not run composer init to create one

Why I can't use "laravel" command inside Homestead VM

I am new to laravel.
So, I have successfully installed and configured Homestead on my Windows machine.
Then I wanted to install Laravel. As I said, I am on Windows, so obviously I don't want to install php, composer and all that stuff on it, that's why I just hit "vagrant ssh" to get inside Homestead and then tried to install laravel following the official documention
composer global require "laravel/installer"
Then I tried to run "laravel" command, but no luck - command not found. I decided, that I had to edit PATH variable, but then I found out that there is no "~/.composer/vendor/bin" folder at all (not it inside /home/vagrant or /root).
and after I got stuck. What do I do wrong, guys?
P.S. "composer create-project --prefer-dist laravel/laravel blog" works fine, but I want to find out how to make "laravel" command work
I don't believe there is a laravel command-line executable.
Are you trying to run artisan commands?
docs
when you run composer global require "laravel/installer" what did it say ? it should output
Changed current directory to /home/vagrant/.config/composer where laravel will be installed
so you can just add /home/vagrant/config/composer/vendor/bin (note config vs what you say ~/.composer/vendor/bin) in your PATH variable and laravel command will work

Running PHPUnit in Laravel's Homestead

I'm using Homestead to serve my Laravel application. I'm trying to run PHPUnit. According to the docs:
An example test file is provided in the app/tests directory. After
installing a new Laravel application, simply run phpunit on the
command line to run your tests.
Well, when I'm "simply running" phpunit in my project root (inside the Homestead environment) I get this:
The program 'phpunit' is currently not installed.
Do I need to install PHPUnit separately then? The documentation does not mention it. What am I doing wrong?
You can install it globally on the system using.
composer global require phpunit/phpunit
However, if you need different versions for different projects this can cause issues.
The alternative option is to use the version installed as part of your dependencies by referencing the path to your vendor directory.
./vendor/bin/phpunit
You could even add an alias to your aliases file in your ~/Homestead directory. That way you're always using the phpunit version that is installed with your project dependencies.
alias phpunit=./vendor/bin/phpunit
You'll need to restart the homestead box to make use of the alias.
You can install it globally with:
$ composer global require "phpunit/phpunit=4.4.*"
# then use
$ phpunit
or you can use it with your local composer:
$ composer require "phpunit/phpunit=4.4.*"
# then
$ vendor/bin/phpunit
Since it's a package required for development, Laravel provide PHPunit(require-dev section in composer), you should find it in vendor's folder :
$ your_app/vendor/bin/
You can run the command from the root of your app folder by typing :
$ vendor/bin/phpunit
I hope it will help !

Installing Laravel

I am on a windows 8 machine and I'm trying to learn laravel. I copy and pasted my PHP folder from C:\xampp to C:\php, installed composer, ran composer install then composer create-project laravel/laravel learning-laravel. So far everything was created so I went into the directory and tried to use 'php artisan serve' and got the following error.
C:\Users\denni_000\learning-laravel>php artisan serve
Warning: require(C:\Users\denni_000\learning-laravel\bootstrap/../vendor/autoloa
d.php): failed to open stream: No such file or directory in C:\Users\denni_000\l
earning-laravel\bootstrap\autoload.php on line 17
Why you copied php folder
download composer install it.
download laravel latest version and store it on your xampp/htdocs/laravel
and run cmd with composer install command
For more follow install laravel on windows xampp
or Laravel 4.1 installation with composer in xampp
For windows Simply download Laragon which includes latest php 5.6.7, Apache, Mysql, Redis, Memcached an alternative to Xampp or Mamp with small size. Easy to install laravel and create project with auto create virtual host by it. Thank you.
U need to go to the directory where laravel is installed and run the following command.
composer update
Install Laravel 4.2 with composer:
sudo composer.phar create-project laravel/laravel project-directory-name 4.2 --prefer-dist
Here is a different way to setup laravel, may be you guys will like it
Step 1:
Clone https://github.com/laravel/laravel or you may download zip also.
Step 2:
Navigate to downloaded folder in command prompt and run composer install
Step 3:
open the folder and rename .env.example to .env and update the credentials mentioned in file.
Step 4:
After these steps if you navigate to the directory from web-server it will cause an error No supported encrypter found. The cipher and / or key length are invalid. to fix this just run php artisan key:generate
Done!
Hope you guys like this way :)
You need to install all the laravel required dependency.
To do that, you need to tell composer to install everything needed.
Below is the command to use to install that's required in laravel composer.json.
composer install
Follow the installation guide from Laravel
Install Composer:
Like Laravel.com says: "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable can be located by your system."
Type the following statement in the command line:
composer global require "laravel/installer=~1.1"
Create a fresh Laravel project in a specified directory with the "laravel new" command:
laravel new blog
You can also create a Laravel project using composer, like such:
composer create-project laravel/laravel --prefer-dist
If you want to learn laravel I seriously recommend you use laravel homestead with vagrant.
For this you need to:
Install virtualbox.
Install vagrant.
Install git.
Install ssh.exe (Download msysgit and copy the content of bin folder to git bin folder).
Install Homestead on Vagrant (Follow the steps on laravel/homestead documentation page).
Install Laravel on Homestead (Follow the steps on laravel/installation documentation page).
This method apply to Windows, Linux or Mac, only change the step 4 on linux or mac.

Categories