-
Download the Symfony2 standard distribution without vendors
-
Unzip/untar the distribution. It will create a folder called
Symfony
with your new project structure, config files, etc. Rename it to whatever you like. -
Create a new file called
.gitignore
and paste the following into it:web/bundles/ app/bootstrap* app/cache/* app/logs/* build/ vendor/ app/config/parameters.ini
-
Copy
app/config/parameters.ini
toapp/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 init
to 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
deps
anddeps.lock
files, then runbin/vendors install
again (upgrade
doesn'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
deps
anddeps.lock
files and thebin/vendors
script 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
.gitignore
file 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.