Skip to content

Latest commit

 

History

History
143 lines (100 loc) · 4.99 KB

new_project_svn.rst

File metadata and controls

143 lines (100 loc) · 4.99 KB
.. index::
   single: Workflow; Subversion

How to Create and Store a Symfony Project in Subversion

Tip

This entry is specifically about Subversion, and based on principles found in :doc:`/cookbook/workflow/new_project_git`.

Once you've read through :doc:`/book/page_creation` and become familiar with using Symfony, you'll no-doubt be ready to start your own project. The preferred method to manage Symfony projects is using Git but some prefer to use Subversion which is totally fine!. In this cookbook article, you'll learn how to manage your project using SVN in a similar manner you would do with Git.

Tip

This is a method to tracking your Symfony project in a Subversion repository. There are several ways to do and this one is simply one that works.

The Subversion Repository

For this article it's assumed that your repository layout follows the widespread standard structure:

myproject/
    branches/
    tags/
    trunk/

Tip

Most Subversion hosting should follow this standard practice. This is the recommended layout in Version Control with Subversion and the layout used by most free hosting (see :ref:`svn-hosting`).

Initial Project Setup

To get started, you'll need to download Symfony and get the basic Subversion setup. First, download and get your Symfony project running by following the :doc:`Installation </book/installation>` chapter.

Once you have your new project directory and things are working, follow along with these steps:

  1. Checkout the Subversion repository that will host this project. Suppose it is hosted on Google code and called myproject:

    $ svn checkout http://myproject.googlecode.com/svn/trunk myproject
  2. Copy the Symfony project files in the Subversion folder:

    $ mv Symfony/* myproject/
  3. Now, set the ignore rules. Not everything should be stored in your Subversion repository. Some files (like the cache) are generated and others (like the database configuration) are meant to be customized on each machine. This makes use of the svn:ignore property, so that specific files can be ignored.

    $ cd myproject/
    $ svn add --depth=empty app app/cache app/logs app/config web
    
    $ svn propset svn:ignore "vendor" .
    $ svn propset svn:ignore "bootstrap*" app/
    $ svn propset svn:ignore "parameters.yml" app/config/
    $ svn propset svn:ignore "*" app/cache/
    $ svn propset svn:ignore "*" app/logs/
    
    $ svn propset svn:ignore "bundles" web
    
    $ svn ci -m "commit basic Symfony ignore list (vendor, app/bootstrap*, app/config/parameters.yml, app/cache/*, app/logs/*, web/bundles)"
  4. The rest of the files can now be added and committed to the project:

    $ svn add --force .
    $ svn ci -m "add basic Symfony Standard 2.X.Y"

That's it! Since the app/config/parameters.yml file is ignored, you can store machine-specific settings like database passwords here without committing them. The parameters.yml.dist file is committed, but is not read by Symfony. And by adding any new keys you need to both files, new developers can quickly clone the project, copy this file to parameters.yml, customize it, and start developing.

At this point, you have a fully-functional Symfony project stored in your Subversion repository. The development can start with commits in the Subversion repository.

You can continue to follow along with the :doc:`/book/page_creation` chapter to learn more about how to configure and develop inside your application.

Tip

The Symfony Standard Edition comes with some example functionality. To remove the sample code, follow the instructions in the ":doc:`/cookbook/bundles/remove`" article.

Subversion Hosting Solutions

The biggest difference between Git and SVN is that Subversion needs a central repository to work. You then have several solutions:

  • Self hosting: create your own repository and access it either through the filesystem or the network. To help in this task you can read Version Control with Subversion.
  • Third party hosting: there are a lot of serious free hosting solutions available like GitHub, Google code, SourceForge or Gna. Some of them offer Git hosting as well.