Skip to content
CiviCRM Extension Builder
Find file
Pull request Compare This branch is 137 commits behind totten:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
src
web
.gitignore
LICENSE.txt
README.md
civix
civix.bat
composer.json
composer.lock
release

README.md

Civix is a command-line tool for building CiviCRM extensions.

Requirements

Unix/Mac Installation (Tarball)

Navigate to https://sourceforge.net/projects/civix/files/ and download a tarball (e.g. civix-X.Y.Z.tar.bz2).

cd $HOME

tar xvjf civix-X.Y.Z.tar.bz2
mv civix-X.Y.Z civix

# Add civix to the PATH; consider updating ~/.bashrc or ~/.profile
export PATH=$HOME/civix:$PATH

Unix/Mac Installation (Git/Composer)

cd $HOME

# If you haven't already, install the PHP tool "composer"
curl -s http://getcomposer.org/installer | php

# Download civix and dependencies
git clone git://github.com/totten/civix.git
cd civix
php $HOME/composer.phar install

# Add civix to the PATH; consider updating ~/.bashrc or ~/.profile
export PATH=$HOME/civix:$PATH

Windows Installation

# Install composer
In a browser, visit http://getcomposer.org
Click on the download button.
Scroll down to Windows Installer and click on Composer-Setup.exe.
Choose Run when prompted.

# Install git
If you don't already have git, then in a browser visit http://git-scm.com/download/win.
Choose Run when prompted.
Leave all the defaults.

# Download civix
Decide where you want to install civix. You might want to put it in C:\Program Files, but you might get hassled about admin rights, in which case you can pick somewhere else, like C:\users\<your name>.
From the start menu choose All Programs -> Git -> Git Bash.
In the window that appears, type:
  cd "/c/users/<your name>"
  (note the forward slashes)
git clone git://github.com/totten/civix.git
exit

# Download dependencies
In windows explorer, navigate to C:\users\<your name> (or whereever you installed civix).
Shift-right-click on the civix folder.
Choose open command window here.
In the window that appears, type:
  composer install

# Add civix to the PATH
Either temporarily add it:
set PATH=%PATH%;C:\users\<your name>\civix

OR permanently:
Start Menu -> Control Panel -> System -> Advanced -> Environment Variables

Post-install Configuration, all operating systems

# Link civix with a developmental CiviCRM site/source-tree.
# This requires knowing the directory which contains civicrm.settings.php
# For example, using a default installation of Drupal-CiviCRM with Debian/Ubuntu,
# the path might be "/var/www/drupal/sites/default/".
civix config:set civicrm_api3_conf_path /var/www/drupal/sites/default/

# To validate that the link is working, run:
civix civicrm:ping

Upgrade

To upgrade civix and its dependencies, one can normally do:

cd $HOME/civix
git pull
php $HOME/composer.phar install

On some occasions, changes in civix, in a dependency, or in composer can break the upgrade. If this happens, then try deleting the dependencies and re-installing them:

php $HOME/composer.phar self-update
cd $HOME/civix
git pull
rm -rf vendor
php $HOME/composer.phar install

Documentation

The CiviCRM wiki includes tutorials for building extensions. See:

http://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension

For reference documentation, civix supports a "--help" option. For example, to get reference materials about the "generate:page" command, run:

civix generate:page --help
Something went wrong with that request. Please try again.