Linesofcode
Linesofcode

Reputation: 5903

How to push new local dependencies to shared hosting with Laravel?

My website is running smoothly with Laravel in a sub-domain, but now I have added a new dependency https://github.com/PHPOffice/PHPExcel to my local project using composer require phpoffice/phpspreadsheet.

The code is already working fine in my local environment, but now I need to push my new changes to the website.

Pushing the controllers, routes, views, etc it's easy, but how do I push the dependency?

For what I have read so far, I should be using SSH with PuTTY, but if I could use an extension in Visual Studio Code, would be great.

Upvotes: 0

Views: 717

Answers (2)

Linesofcode
Linesofcode

Reputation: 5903

Well I can create SSH keys but don't have access to login with them. With that said I follow the tutorial here https://laraveldaily.com/laravel-and-shared-hosting-working-with-ftp-and-phpmyadmin/ that teaches how to use FTP to upload/update the application.

Upvotes: 0

Chad K
Chad K

Reputation: 952

Composer stores all the imported libraries in the /vendor folder. When you push your local copy of the website up, it will push up the vendor folder and you'll be set.

If you're working on a remote server and you need to still download the dependencies, run

php composer.phar update

That will download the dependencies for the project. You'll need to run it from the command line (ssh) and be in the website directory.

Some companies don't allow ssh access to the server. In that case, you can run php composer.phar update on your local machine, assuming you have a php runtime install (WAMP, XXAMP, ect). Then when you push or copy your code to your server, the libraries will be included.

Upvotes: 2

Related Questions