Add FOSUserBundle to project git repository
I use composer to install FOSUserBundle in Symfony2, I can’t add the bundle to my project git repository.
I found in FOSUserBundle there has a .git directory and has its own config.
- Composer update undo deleted vendor
- Pre commit hook to check PHP code coverage and code sniffer for Symfony
- How to write symfony2 effective
- Untrack git file
- How does Symfony manage Component sub-packages with Git and Composer?
- (There is no extension able to load the configuration for “sonata_block”
When I use git add -A always get “commit or discard the untracked or modified content in submodules”.
Can you help to show how to add this bundle to my repository?
Thanks in advance.
2 Solutions collect form web for “Add FOSUserBundle to project git repository”
You could do something like this:
$ git add vendor/path/to/Bundle/*
You could also create a git submodule of the User Bundle in the
git submodule add <git@github ...> src/FOS/UserBundle
If you are going to do this you shouldn’t use composer to install this dependency.
BUT Before you start adding third party bundles to your own repository ask the following questions:
- Do you need to modify/extend the default functionality of the Bundle?
- Do you need to fix a bug in the code?
- Do you need to re-write big chunks of the original code to fit your specific use case?
If your answer to #1 is
You want to take a look at these resources
- How to use Bundle Inheritance to Override parts of a Bundle.
- How to Override any Part of a Bundle.
The code you end up with will sit on top of the user bundle and it can go in your own repository.
If your answer to #2 is
- Make sure it is really a bug (read the docs).
- Create an issue on github.
- Create a fork from the original repo.
- Fix the bug in your fork.
- Submit a pull request.
See more information in the Contributing to a project section, and the Contribute Code for Symfony for general guidelines on how to contribute to projects.
If your answer to #3 is
Create your own fork of the user bundle and work with that. Add the fork to your own project as a sub-module or create a packagist package that can be installed via composer.
The reason why the bundle is not added is because of .gitignore file that exempts ‘vendor’ folder , where all the bundles resides.
What you can do is push new ‘composer.json’ file with bundle information.
And from the server pull the new composer and do ‘composer.phar update’