I used to map only one folder to my projects root folder as recommended in Laravel 5.6.
Now, I mapped each folder to each separate project as recommended in Laravel 6.x.
Now if I login into my VS with vagrant ssh and try laravel new myproject I get
The provided cwd "/home/www/myproject" does not exist
If I create the folder beforehand, than I get
Application already exists
If I install as root, then Laravel gets installed, but I can't find my project on my PC. I see it on my VS, buts it not on my hard-drive.
This is the config in my Homestead.yaml:
- map: ~/www/homestead/myproject # Path on my laptop
to: /home/www/myproject #Path of VM
I find /home/www/myproject which I created on my VS, but ~/www/homestead/myproject does not exist on my PC.
I did not have these issues when I was only mapping one folder. How can I fix this and create a new Laravel project?
I solved this by installing Laravel command globally with composer on my PC. To do so, I had to install zip first:
sudo apt-get install php7.2-zip
Then I could install it globally
composer global require laravel/installer
Which displayed
Changed current directory to /home/adam/.config/composer
and I had to add this to my ~/.profile:
PATH="$HOME/.config/composer/vendor/bin:$PATH"
I reloaded profile in command with source ~/.profile and then I finally could install Laravel from my PC instead from the VM.
Related
I try to create a clean project with Laravel and Homestead, so that if somebody download my project, only a vagrant up is necessary... look like a Paradox or maybe I do something wrong.
I create a new laravel project dir
I run composer require laravel/homestead --dev to install homestead.
I get requirements errors because the composer.json was already created from laravel, and it needs the requirements from the VM
I could do a composer install inside the homestead VM
But the homestead VM doen't exist already because I can't install homestead
To make homestead works but not the right workflow:
I did a composer require laravel/homestead --dev outside the laravel dir and I copied the homestead files inside the laravel project dir
vagrant up from the laravel dir
composer install in the VM (this remove all the homestead files because homestead isn't in the composer.json)
This looks wrong, which would be the right way to add homestead to a laravel project?
Ok I figure it out.
You can put the homestead folder and the laravel folder in the same project, like:
--project_folder
|--homestead
|--laravel
And change the path in Homestead.yml to the laravel dir
Then to take the project running:
do a compose install in homestead
vagrant up
in the VM compose install to prepare the laravel app
I wish to start a new symfony project,I want to use composer for the added advantages, but am having using the installed composer in my new project folder. The composer already installed came with Acquia dev desktop. when I run 'php composer.phar' in my new project folder I get this error "Could not open input file: composer.phar"
Double check where your composer.phar file is located.
If it has been installed into your old project's folder, simply copy it to the new folder.
If it has been installed globally (i.e: it is not in your old project's folder), then make sure you are using the right command, you might need to simply do composer install instead of php composer.phar
I am trying to run unit tests in a new laravel 5 application, using the phpunit framework. In the root path of my laravel application I ru the following command:
./vendor/bin/phpunit /tests/ExampleTest.php
And then I get the following message:
You need to set up the project dependencies using the following commands:
wget http://getcomposer.org/composer,phar
php composer.phar install
I already have composer installed in may system and I install Laravel 5 using composer. Isn't phpunit installed when I install a new laravel 5 application? If not, how can I install it in a existent laravel 5 application?
I known that I can also install phpunit globaly and resolve the problem. But maybe it will be a duplication since I have all the phpunit code already in may laravel application.
I had the same problem and it had a specific solution that may apply to other people. I store my files in Dropbox, and the vendor/bin/phpunit file should be an symlink like this
$ ls -lo vendor/bin/phpunit
lrwxr-xr-x vendor/bin/phpunit -> ../phpunit/phpunit/phpunit
However, Dropbox will occasionally replace symlinks with the original file, and this will cause the error above. The behaviour is inconsistent, and with relative symlinks seems to break when 2 machines are accessing Dropbox at the same time. Fixing the symlink worked for me or you could make a new symlink directly to the vendor/phpunit/phpunit/phpunit outside of Dropbox and run that.
Edit: Nowadays I exclude Vendor and node_modules from Dropbox - and simply run composer install when necessary. This works really well, and also deals with the hassle of syncing so many files on Dropbox. What you can do is go into the folder and delete all the files. Wait for Dropbox to sync. Then mark the folder as excluded. Finally, run composer install and you get the contents as you need. (Delete + composer install often solves other issues too).
Running composer install did nothing in my case. However, removing vendor folder and then calling composer install fixed it.
You need to have Composer installed and run composer install or composer update in your application to install the different packages listed in your composer.json.
When you install your Laravel application it doesn't install the packages right away.
You can verify the packages are installed by looking in the vendor directory of your application and check that phpunit is in there.
did you install phpunit globally? I recommend you do it.
just type in your laravel's root directory (e.g. /var/www)
cd /var/www
phpunit
if you what to test just one file, you can do something like this:
phpunit tests/ExampleTest.php
Unit Test:
D:\xampp\htdocs\Samplemed\vendor\bin>
phpunit ../../tests/Unit/Company/CompanyUnitTest
Feature Test:
D:\xampp\htdocs\Samplemed\vendor\bin>phpunit
../../tests/Feature/Company/CompanyFeatureTest
Please try this. its working fine.
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.
I'm developing a laravel application and my computer die.
Now I want to get my project from the repository (Bitbucket + Git) but thanks to the git ignore file, the vendor folder is missing. I can't do a composer install on my project because is not allowed (the directory should be empty). The structure of my project is the same as the laravel installation except that I renamed the public folder.
I found this thread but did not solve my problem.
Integrating existing project by laravel framework?
I wanna know the best practice or way to do this and i don't think that copy and paste the folder of my project to a fresh install of larevel should be the way.
Thanks.
Go to your www folder
cd /var/www
Git clone your application (not that here the directory must not exist):
git clone https://github.com/antonioribeiro/application
CD into the folder
cd application
Execute composer update (if you are in a development environment)
composer update
Or execute composer install (if you are in a production environment)
composer install
Note that for composer install or composer update, the folder may actually have files and even a vendor folder created, there is not such obstacle.