Installing laravel on existing project - php

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.

Related

The provided cwd "/home/www/myproject" does not exist

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.

Accidentally removed vendor folder in laravel project

I was working with a laravel project and, accidentally, removed vendor folder.
What should I do? Create a new project and copy it or download it anywhere else?
I had no additional composer dependencies installed.
Just run composer install after cding into the Laravel project's directory.
The Vendor folder is created by running composer install. It contains only the packages which you have asked composer to track in the composer.json file. If you have a composer.phar file in the root of your application run php composer.phar install.
https://getcomposer.org/doc/00-intro.md is probably your best source for additional information.

Changing laravel file structure

I am new to Laravel and PHP programming. I am building a web application using laravel framework. When I create project using composer create-project it creates laravel files inside the laravel folder and I move all the files out of laravel folder and delete the empty laravel folder as belo.
-root folder
--app
--bootstrap
--config
--database
--public
-----------
After, I pushed the project to github and clone it from another computer and to add laravel files I execute composer install. Now laravel framework files are created inside a laravel folder instead of root directory.
-root folder
--app
--bootstrap
--config
--database
--public
--laravel
----app
----bootstrap
----config
----database
----public
How can I change the location, composer create the laravel framework files?
If you want to install laravel with composer then you should follow bellow this way:
Firstly install Composer according to your operating system.And then if you use xampp then create a project folder or run a command composer create-project --prefer-dist laravel/laravel blog this will create a root folder and a sub-folder named laravel.
Your problem is that when you secondly clone git form github that time you mixed up the main root folder that's why its duplicated.
I think you should re-install again according the given procedure.Hope this will solve your problem.
Another way: if in your pc have installed composer then you just clone the git and after that in the root folder (cloned git folder) run the command composer update.It should solve your problem.
Tricks: For opening root folder with command for windows operating system. Press select the root folder and Ctrl + Shift + right button of mouse then click the options Open command window here .
LARAVEL DOC.
Thanks.
Use this to create Laravel project
composer create-project laravel/laravel YourProjectName

What files to put on Bitbucket so that my teams could use?

I have a setup a Laravel 5 project locally and want to put it on bitbucket account so that my remote team mates can install it. Locally from command line I ran following command:
composer create-project laravel/laravel myproject --prefer-dist
which did everything. Now it sounds stupid to put all. I already uploaded my composer.json file. What instructions should I send out to team so that they just clone directory and install it? Do I dump each thing and they just clone it? Will they have to run composer create-project command anyway?
Here, no need to run composer create-project, they just clone the project and run composer install to deploy the project in their local.
As composer install will install all of the framework's dependencies, don't upload vendor folder to source (Bitbucket).
You can send following instructions
Project requirments
List of tools and technologies to run the project
Ex: PHP and mysql version, Frameworks (js, css) used and tools required NodeJs, Gulp, Bower or any other
Installation process
create folder project_name and clone project into it
open composer.phar and run composer install
setting up environment to run project with required tools

Laravel - Export project in other folder for deployment

Is there a way to clean unused dependencies and composer dev requires to reduce a Laravel project, because it's so heavy (43,3 Mb) and it's a small project. Btw, I'm using some dev helpers like Debugbar and IDEHelpers which are not used for deployment...
Is there a way to make a deployment version of my project in other folder
The recommended way to deploy your app is without the vendor directory. I'm going to assume that you're using git for your project. First, put the following in your .gitignore.
/vendor/
Now remove the vendor directory from your repository
git rm -r --cached vendor
git commit -m 'Removed vendor directory'
Now you have a two step deployment:
Update the app using git pull or however you usually deploy.
Run composer install --no-dev --optimize-autoloader. This will generate your vendor directory omitting any development only dependencies.
In order to take advantage of the --no-dev flag, you need to put your development dependencies in the require-dev section in your composer.json. For example:
"require-dev": {
"phpunit/phpunit": "~4.3"
}
Now PHPUnit will be required for development, but not when the --no-dev flag is specified.
Maybe I'm misunderstanding your question but when you deploy a project, you shouldn't be deploying the laravel app with it (/vendor/). You should run composer install and it will pull in all the dependencies. In your composer.json file you can also choose which dependencies are for dev environments only similar to the require-dev section found here: https://gist.github.com/philsturgeon/5976359

Categories