CiviCRM Developer Guide

BASIC SET UP

When writing CiviCRM customizations and extensions make sure you don't do it in a production environment! You don't want to interrupt your organisations or users' work or corrupt the data in the database. Instead you should always create a separate local development environment where you can do whatever you want to CiviCRM without disturbing anyone else.

If your computer runs Linux or Mac OS X, running CiviCRM on your local machine is pretty easy. If your computer runs Windows, you have a little more work to do, but it's not impossible - you could consider running Linux inside a virtual machine. There's a free program called VirtualBox that makes this pretty easy. We recommend running the latest version of Ubuntu Linux inside the virtual machine. You can download that here: http://www.ubuntu.com/

Installing CiviCRM

http://wiki.civicrm.org/confluence/display/CRMDOC40/Installation+and+Upgrades outlines pre-installation requirements and gives step by step instructions for installing CiviCRM.

Installing from SVN

CiviCRM developers use SVN to collaborate.  If you are doing a lot of development in collaboration with the core team or other developers, you might want to install from SVN.

Instructions on installing from SVN are available here:http://wiki.civicrm.org/confluence/display/CRMDOC40/Installing+CiviCRM+from+subversion+%28SVN%29+repository

Using source control management

It is good practice to put any code customisations that you write under version control.  Keeping your code in a repository means that you have access to all previous versions of the code and can revert back if anything goes wrong (which with any complex project, will inevitably happen one day).  Although CiviCRM uses SVN, we recommend you consider using Git for any code that you write.  CiviCRM will migrate to Git at some point in the future.

Putting your source code in a public repository is even better as it makes it public from day one and easy to share.

Logging emails to a file

If you have a local test environment set up and want to test processes that involve sending emails, you can set CiviCRM up to log emails to a file rather than sending them.  To do this, modify your CiviCRM settings (http://civicrm.settings.php) and add following line:

define('CIVICRM_MAIL_LOG', '/path/to/mail.log');