CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Civix Installation: How to.
Pages: [1]

Author Topic: Civix Installation: How to.  (Read 829 times)

mgribaudo

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.6.11
  • CMS version: Drupal
  • MySQL version: 14.12
  • PHP version: 5.5
Civix Installation: How to.
February 24, 2016, 09:30:52 am
Hi,
I'm trying to install civix in order to write my first extension, but I'm finding some difficulties to understand the way to do it.
I'm on a windows machine and :
  • I downloaded the civix-master.zip files
  • I downloaded the civix.phar

My questions (I'm newbie in this kind of operation and the samples are linux-oriented) are:
- where must I extract/copy the downloaded files?
- after this operation, I must build something before generating the skeletal extension?

Thanks for your attention

Marcello



JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Civix Installation: How to.
February 24, 2016, 12:31:14 pm
Hi Marcello,

Some of these answers changed literally two days ago!  I'm going to paste a message about that from Tim Otten, the author of civix, at the end of this post.  Also, the best place to ask these sorts of questions now is on Stack Exchange: http://civicrm.stackexchange.com

To answer your question, I think we'd need more information. 
Are you comfortable running (and set up to run) PHP scripts from the command line?
Do you know how to view/edit your PATH in Windows?

Those are both important pre-requisites.
The first question is beyond the scope of what I can answer here - but you can get started here: http://php.net/manual/en/install.windows.commandline.php
Next, to view your PATH, you can run this from the command prompt:
echo %PATH%

To add a directory to your PATH, you can do this:
PATH=%PATH%;C:\path\to\civix_directory

When you run a command like "civix", it needs to either a) be in your current directory, or b) in a directory named in your PATH.  So you can extract it anywhere, but you must add that directory to the PATH.

Finally - many folks who run Windows as their primary computer use Vagrant with Virtualbox to run Linux for CiviCRM development.  I'm not sure if you're comfortable with basic Linux, but you may find more help that way.  That said, many stars of the CiviCRM community develop on Windows, so it's definitely doable.

Jon

Announcement from Tim:

TLDR

1. If you’re using buildkit, carry on.

2. If you install civix manually, the procedure has changed. Instead of using tarball or composer, I recommend using the PHAR executable. Updated instructions are at https://github.com/totten/civix

DETAILS

civix was originally based on Symfony Standard Edition (SE) and followed SE’s workflows. This was a nice learning experience, but SE is not really intended for CLI apps — there are a ton of dependencies; a more nuanced workflow; you need writable folders within the source-tree (app/cache, app/log); and it’s harder to juggle multiple versions.

For CLI apps, it’s easier to use an executable file (aka PHAR). You only need one download, and you can put that download anywhere you want (~/bin, /usr/local/bin, etc), rename it, etc. As of v16.02.0, civix is packaged as an executable file (based on Symfony Components).

As before, buildkit automatically downloads civix and any dependencies.

I haven’t tested for Windows. Patch-welcome if there are issues on Windows.

Changelog: https://github.com/totten/civix/blob/master/CHANGELOG.md#v16020
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

mgribaudo

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.6.11
  • CMS version: Drupal
  • MySQL version: 14.12
  • PHP version: 5.5
Re: Civix Installation: How to.
February 25, 2016, 12:51:57 am
Thanks a lot JonGolg,

your answer was very exhaustive, I've done big steps

- set the environment variables to allow php scripts to be executed from command line
- put the civix.phar folder in the %path%
- now the  civix.phar command executes from any folder

but  ....

any syntax I use in the command line (eg. civix.phar generate:module <mymodulename> or civix.phar list ...) always return the help output as if the options or argument where missed

Any idea?

Marcello

As you suggest, I will move to the stackexchange.com for next questions-

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Civix Installation: How to.
February 25, 2016, 06:48:28 pm
It's really weird... within a couple days of posting PHAR instructions, there was pushback from multiple Windows users about the PHAR distribution.

My interpretation from the reports and some googling: Windows PHP is the wild west, and you can't expect PHAR's to work there. This isn't a problem with php-core -- the problem is that there are so many different PHP builds (WAMPs and XAMPPs and MAMPs and Acquias and Cygwins and such), and it's a crapshoot whether they've enabled PHAR support. And god help the user who has multiple interpreters installed. Recommendations on the web are to create stub *.bat files or add custom registry entries (with references into your preferred PHP runtime)... all of which defeats the goal of standardized executable file.

This seems ripe for some kind of common solution (eg a small *.exe that scans for PHP runtimes and configures the registry) which would benefit other PHAR publishers (getcomposer.org / drush.ws / phpunit.de / symfony.com / etc). But... it's not really my thing...

Anyway, we weren't getting these complaints about Windows before, so I've restored the old Windows installation notes in README.md (with a very small edit to PATH).

https://github.com/totten/civix/blob/master/README.md

mgribaudo

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.6.11
  • CMS version: Drupal
  • MySQL version: 14.12
  • PHP version: 5.5
Re: Civix Installation: How to.
February 26, 2016, 12:22:51 am
Hi,
I dont' know if it can be usefull, but I solved.
From the command line I entered:

php civix.phar genereate:module --help

instead of

civix.phar genereate:module --help

Marcello

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Civix Installation: How to.

This forum was archived on 2017-11-26.