how to install dependencies of a Laravel project? - php

I am very new to Laravel, I have got to work on an existing project that is located on a server. I am able to access the source code through the FileZilla. The size of the whole project on the server is more than 6 GB. I know that I shouldn't download the whole project but the main folder and run composer install command to install all the dependencies specified in the vendor/composer folder. but I am not able to figure out the structure of the project and which part I need to download in order to run the composer install command and get the project running locally on my machine. Below is the project structure on the server.
I can right-click on a node and select download. which folder is the main project? that I assume it should only has the main files and the composer.json file where all deps are specified in it?

you may need to download the whole project, since there are Controllers, Migrations, resources, etc.

Related

Uploading a Symfony 3.3 project

I finished my symfony project, and bought a hosting and domain. Previously I have uplaoded sites to web, but it was just put everything in public_html folder, and the site is running. I tryed this with the project, but it wasn's the case. I'm a bit confused, because at the my storage I had a lot of folders on default. This is how it looks:
Where should I upload my folders?
Uploading symfony is a little tricky thing , symfony is not a normal website it's a big framework
First you need hosting with ssh access ( without it you'll have a lot more problems )
create folder symfony on the same level that is public_html
copy all your project data , without vendor directory and composer.lock file
login via ssh and
cd symfony
composer install
You shoud always use composer - because it 'll check all dependencies with you php version on server (different libs and extensions may require different php version and diffent modules) , and let you know if something will be not right.
rm public_html folder, and create symlink to symfony/web
ln -s public_html ~/symfony/web
upload sql to database

Compser projects self-contained?

I'm new to the whole Composer/dependencies game.
I want to know whether if I create a project using, for example composer require intervention/image from a cmd window opened in the project root folder, the project is then completely portable. Meaning if I copy the project folder on to another machine with no internet, no composer installed and none of the other dependencies installed, will it still work?
Put another way, when I run composer require intervention/image are all of the necessary files cloned locally?
You get a local copy of the files so if you manually copy the project, the vendor directory will go with it. If using Git, typically a .gitignore is set to ignore this dir and you won't get it on clone.

Installing existant laravel project on wamp for pre-production

I have a existing laravel project that I have been working on for a while now.
I have to put it in a test environnement to show it to my employer.
My problem is that I have no clue how to use my git repo of the project to put it on a fresh installation of wamp server.
1 - I have tried to install it as a whole but failed.
2- Then, I tried creating a fresh copy of Laravel base architecture (that worked) and after, replacing the files I modified on my existing project over on the fresh Laravel project. Turns out, it can not find my login.php page and I am stuck at that point.
So I want to find the easiest way to clone a git repo with an existing Laravel project directly on a wamp server and make it work.
I have been trying for several weeks, please help me.
Thanks
Okay, here are some simple steps to create a copy of your Laravel5 project on another server:
Setup the server (Databases, PHP and so on) and install Composer. If you are local, composer should already be installed
Clone the repository and copy the content to the htdocs or var/www folder, depending on your server system
Now execute composer update to load all dependencies
Last but not least, setup your .env file. Use the .env.example from Laravel5, add your credentials, generate a key with php artisan key:generate
That's it. Now your Laravel5 project should run.

I can´t get all folders from my branch on GIT

I have a git project with one branch, I´m trying to clone all files in my local folder, but I can´t get the vendor folder. I would like to know if I can do it in other way to get also vendor class.
I´m running this:
git clone -b branch_name repo_URL
As I say, I don´t get one folder. What I need to do it to get all files?
PD: I can´t download a ZIP of the project.
You are not supposed to find that vendor folder in your repository. It would be useless redundancy.
In modern PHP projects, Composer is being used to manage external dependencies. When running composer update, it reads a file composer.json (which should be present in your repository) to find the most recent versions of the external packages to be used.
This creates a file composer.lock (which should also be in your repository) with the exact versions and commits that got downloaded. If at any later time someone (like you now) wants to recreate the contents of the vendor folder, they run composer install, which will try to get everything that was once downloaded.
So the first step for you is to download Composer, then run composer install (depending on your way of downloading, it might also be php composer.phar install or something close to that).
Reasons for composer install to fail is that dependencies can no longer be downloaded because they were removed from the internet, or that the project is too old and has too old versions of said files so that it does not run with current versions of Composer (although this should be very rare). In any case: If you encounter errors, ask a new question here with all the details, including the full output of the Composer command.
The reason why you don't get the vendor folder is because the vendor folder never went up to the git repository. If you see the .gitignore file, you will notice a :
/vendor
This tells git to ignore that folder and not to send it up to the git repository when you are pushing. There is no way for you to get that folder unless you find the original project before you pushed to the git.

Laravel 4.2 Files to upload after Composer Update

I had a website created in Laravel 4.2, its live and had to make some changes in it. To make these changes I had to use a package that wasn't used before, so I required the package and did composer update.
The new package that I've used, has created a folder inside app/config/packages.
Besides the controllers and views where I've made the changes, what files I'll have to upload now? Composer update command has updated a few packages and downloaded the new one.
I just want to know whether I'll have to re-upload whole site or there are some specific files or folders that I can upload and get the website working perfectly.
Ok, I have spent good time over this and figured it out.
Changes due to newly installed package:
I used a package to export data to excel Maatwebsite/Laravel-Excel. I had to to add service provider, alias and do composer update. The package created few config files in app/config/packages/maatwebsite folder.
Other Changes:
Apart from above mentioned things, when I did composer update, it updated composer, symphony, monolog, phpoffice and autoload.php inside vendor folder. It also created new folder called maatwebsite inside vendor. Apart from these, the views and controllers I changed myself to export data to excel.
So, I basically uploaded all the following to my website:
controller, views files I changed.
composer.json & composer.lock files.
Files & Folders inside vender (vendor/autoload.php, vendor/composer, vendor/symfony, vendor/phpoffice, vendor/maatwebsite)
Config files of newly installed package i.e. (app/config/packages/maatwebsite)
Finally my app/config/app.php file where I added service provider and alias
And the website is working perfectly fine. So there was no need to upload everything. :)
Hope this will be helpful for others.
If you have a proper deployment plan, having the composer update command run once the code has been deployed would fix all of that. Otherwise, you're going to have to upload everything that is new, and everything that has changed.
If the directory is empty, you're going to have to manually create it on the server. I would imagine that besides that directory, it'd be any published content, such as configs and what not, the package folder, composer.json and the composer autoload.

Categories