I am using a package for Laravel but I want to modify one file in the package. Since the /vendor folder is in .gitignore modifications will not apply to the repo.
How can I move the package or the exact file I want to edit outside the vendor folder?
Related
In a Shopware system, there's a main composer.json file. This manages the main project dependencies. In addition to this, Shopware plugins require you to add a composer.json file. If these plugins are added to the system via the main composer.json file, then the dependencies in a plugin's composer.json file will end up in the root level vendor/ folder. This I understand.
However, it appears that plugins can also be installed locally outside of the vendor folder, in either
./custom/plugins or
./custom/static-plugins
When a plugin is installed locally, how should its dependencies be managed?
Is the intent that, when installing a plugin locally you'll also add its dependencies to the main composer.json file? Or is there a way to tell shopware
Hey, install this plugin's dependencies
Also -- how do the ./custom/plugins/*/packages folders enter into this? It's my vague understanding that these are for private plugin dependencies, but I'm not sure what that means or how that code should be managed
Or am I misunderstanding the intent behind these local folders, and the expectation in Shopware 6 is that all plugins should be installed via your main composer.json file and the custom/ folders are just legacy?
Or some other thing?
If your plugin lives within the custom/static-plugins folder, you can just composer require my/plugin from the root. So that's the way to use composer plugins within your project. Shopware is then searching for the composer plugin within the custom/static-plugins/* repository.
Take a look at the Require project plugins section within the Docs on how to deal with requiring composer plugins.
Within the custom/plugins folder you have all your store plugins. That's also the reason why the content of the custom/plugins folder is not committed to your git repo. Because plugins within custom/plugins are coming from the Shopware store. However: You can still also just place your plugins within the custom/plugins folder if you want to.
Regarding custom/plugins/*/packages: You're right. Take a look at the adding private composer dependencies section within the docs.
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
If I don't have ssh access and can't run composer command over server.
How can I upload laravel packages properly through GIT repository, so that my project will run without any problem .
I know If I remove vendor folder from root .gitignore then vendor file will up to the server.
But still I have doubt, I have to do other thinks also.
I am not good in git thats why before messing laravel I am asking this.
The general recommendation is not to commit the vendor directory, that's why Laravel ships with a .gitignore file that contains the vendor directory amongst other things.
However, there are situations such as yours where this is not possible, so in that case there is a nice section of the Composer Documentation that offers some advice on how you should handle committing the dependencies to version control:
Should I commit the dependencies in my vendor directory?
I have some great code I want to share....so I am moving code from my laravel 5 app into individual packages for use through composer/packagist.
This will also allow me to separate out code I only want in development and avoid deployment of nasty database modification classes to production.
I am confused on setting up git. My main project is running on a git repository. I am developing the packages under a sub-folder named packages/myname/package_name1/ . Each package is going to want its own git repository.
Should I add the folder "packages" to my .gitignore file for my main repository, then set up a git repository for each subfolder?
I followed this tutorial: Setup Laravel 5 Package
If you're using composer/packagist then yes, you should add the folder packages to .gitignore on your main repository. When deploying the entire application or when updating a package you'll have to do a composer install/update to keep everything up to date.
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.