-
Download the Symfony2 standard distribution without vendors
-
Unzip/untar the distribution. It will create a folder called
Symfonywith your new project structure, config files, etc. Rename it to whatever you like. -
Create a new file called
.gitignoreand paste the following into it:web/bundles/ app/bootstrap* app/cache/* app/logs/* build/ vendor/ app/config/parameters.ini -
Copy
app/config/parameters.initoapp/config/parameters.ini-dist-- this will keep your passwords out of the git repository, and will also allow other developers to use different database settings, etc. -
Type
git initto start a new repository -
git add *to add everything we've just done -
git commit -m "Initial commit" -
Now to get your vendors - run
php bin/vendors install.
Notes:
- Your repository isn't safe yet! You should either set up a bare clone on another server and push to it, or even more simply (if you don't mind paying or making it public), set it up on GitHub.
- Whenever you need to update, update your
depsanddeps.lockfiles, then runbin/vendors installagain (upgradedoesn't do what you probably think it does!) - In this setup, the vendors aren't part of your git repository, not even as submodules. Instead, we rely on the
depsanddeps.lockfiles and thebin/vendorsscript to manage these. Those files are part of your repository, so the necessary versions of each third-party library are version-controlled in git, and you can just use the vendors script to bring your project up to date. - It's important to set up your
.gitignorefile and commit it before you run the vendors script, because the script finishes by running Symfony2, which will create a bunch of cache files and stuff you probably don't want in your repository.