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.
Related
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.
As you can see here: Specifying Dependencies
Google App Engine "Composer runs automatically when you deploy a new version of your application..."
I would prefer it didn't. I have scripts that run prior to deployment to remove all of the unnecessities in composer dependencies that are not needed in a deployed application (documentation, testing, etc.).
My .gcloudignore file does not include the /vendor directory and this is confirmed by the file count on upload. When I checked the deployed source however, the composer dependencies do not match my cleaned local dependencies because App Engine is overriding them.
Not sure why this is a feature in the first place, it seems it would be better to leave this in the control of the developers.
I do have billing enabled and am full featured. Thanks!
EDIT
I added the composer.json and composer.lock files to the ignore file to prevent the update and then the vender directory was missing completely from the deployed source. The vendor directory is not in the ignored file and has been uploaded. If I add a depenency, for example, the upload file count reflects the file count for the added dependency files.
It makes me wonder if something is running after the upload during the deployment to remove the vendor directory. They do have it as being removed by default in the ignore file. I assumed though that by taking it out it would allow the upload and deployment of it (the vendor directory)
I've been working on reproducing your issue and trying to attain exactly everything you described as things you need to happen. And I've found some interesting things.
I wanted to see the exact behavior of a vendor/ folder when you deploy it to GAE and understand exactly what causes your issues, so i followed these steps:
Cloned a simple PHP project just to save time.
Installed composer locally so i can require the dependencies.
I required a simple dependency (so it creates the vendor/, composer.json, composer.lock
composer require phpunit/php-timer
This made me have locally the dependencies so it directly uploads them. Can you try to do that with your composer file before attempting to deploy?
I did gcloud app deploy and it uploaded everything, I still have my doubts as if this is my local folder or generated at run-time.
Then I made a simple .gcloudignore as a test, added test* into it, did a gcloud app deploy, and it uploaded everything except the test folders.
Here you can specify everything that you want to avoid uploading, i think this would be a much easier solution for all your troubles. These are the .gcloudignore formats you can use.
It worked for me like this, hope it can help you out.
Let me know.
I'm trying to upload my edited (custom) versions of some vendor packages
Example I edited some code in
vendor/misd/linkify/src/Misd/Linkify
I changed a few lines to work for my project.
The problem is when i push my project to github then deploy using envoyer , All the vendor files get reinstalled via composer update, thus grabbing from the GitHub repo
I need to be able to upload my own version of that specific vendor folder/file
I've tried whitelisting specific vendor file via gitignore , heres my original question Uploading Specific Vendor files with Laravel's Envoyer
But with no luck. Is this good practice, should I be going about it a different way? How can I get my modified version up to my server
Unless you have write access to the Vendor Project, you won't be able to push changes. You need to fork the Misd/Linkify vendor project and make changes and push to your fork.
Then use Composers Repository Package pattern and provide the path to the forked project.
If it is a private repository refer https://getcomposer.org/doc/05-repositories.md#using-private-repositories
I've done lot of Google but still looking for solution, I'm working on Laravel5 project & wants to set it up with GitHub so multiple developer can work on it.
I've install Laravel & place in a repository on Git, Now I cloned it on my local machine & another developer also clone that repository in his machine and start working.
But issue is that, I have installed a package for HTML forms in my machine by composer & push my code to github. But when another developer pull the repository then his code is break because composer.js is updated for that package but actually that HTML package is not exists on his machine.
Can anyone help me to short out this, or is there any way so we ignore vendor folder, composer.js, app.php etc files during git Push?
To answer your question specifically, yes you could choose to ignore the vendor folder, composer.json and app.php files when you push to git. To do this, you would simply need to update your .gitignore file to reflect this. I.e, include these in your .gitignore:
/vendor
composer.json
/config/app.php
But then the next question is whether you really want to do this, as doing so would mean that changes you make - and any subsequent pushes - may not be compatible with work the other developer is doing down the track.
If you exclude the /vendor file and the /config/app.php file but leave the composer.json file in there now that the other developer already has a copy of the core files, the updated composer.json file they download would allow them to use composer install to update the project with the new package.
However all of this would be problematic for a developer who joins you down the track and doesn't have any of the current files.
I have a web application that I built using FuelPHP which is hosted on a private GitHub repo.
I recently added JAXL and APNS-PHP to the project using Composer. Specifically, I created a composer.json inside of the fuel/app directory with these contents:
{
"require": {
"varavan/apns-php": "dev-master",
"abhinavsingh/jaxl": "3.*#dev"
}
}
I ran composer update and everything works fine on my local development environment. I can push to GitHub just fine from the command line also.
However, when I pull on the public server, the newly installed composer packages are not included in the pull, although their directories are created. Specifically, these directories exist, but are empty:
fuel/app/vendor/abhinavsingh/jaxl/
fuel/app/vendor/varavan/apns-php/
If I look at those directories on GitHub, they don't look like directories. They've got an icon that I don't recognize:
Also, if I click on "Sync Branch" from the GitHub GUI app, it gives me this message This has been resolved, see update below.
The submodule at 'fuel/app/vendor/abhinavsingh/jaxl' was removed from
.gitmodules, but the folder still exists in the repositroy. Delete the
folder, commit the change, then try again.
WHAT!?
I used composer to install JAXL, not Git.
If I run composer install on the server, it says:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
But the JAXL and APNS-PHP directories are still empty.
How do I get the composer packages onto my production server?
Update
I added this to my .gitmodules file:
[submodule "fuel/app/vendor/abhinavsingh/jaxl"]
path = fuel/app/vendor/abhinavsingh/jaxl
url = git://github.com/abhinavsingh/JAXL.git
[submodule "fuel/app/vendor/varavan/apns-php"]
path = fuel/app/vendor/varavan/apns-php
url = git://github.com/varavan/ApnsPHP.git
That fixed the error that the GitHub GUI app was giving me, but I still can't figure out how to get the composer packages installed on the production server.
I continued to try everything I could think of to get the composer packages loaded, but I couldn't figure it out.
After adding the submodule definitions to my .gitmodules file, I deleted the entire project from the production server and re-cloned the whole thing from GitHub. The submodules came along for the ride.
It's not the composer way of doing things...
Whatever. What a waste of time.
Composer uses git, especially if you specify you want a development version. It will get it directly from the source.
And if you create a second vendor folder inside app, and Composer has added a git repository there (because of what you specified), git will detect a repo-in-repo, and since submodules are active for Fuel, it will assume you're adding a new submodule.
Like Martin Bean said, make sure you exclude the vendor folder, to prevent this from happening.