Simon Holywell

Posts tagged agavi

Agavi Form Population Filter

Attaching the population filter without using form IDs (suitable where the current form is on the same page as the URL in forms action parameter)

http://gist.github.com/294742

Use form ids to link the pre-population to a particular form

http://gist.github.com/294743

The above hints were created with help from IRC.

Agavi PHP Framework Resources

Agavi Framework Logo

Agavi Framework

Bitextender backed Agavi is a very secure and helpful open source (LGPL) MVC framework with the core development being headed by David Zülke (Wombert) and Felix Gilcher (certainly in the IRC channel!). It can take some time to get the hang of the framework so I have put together all the resources I use or have used to help you get started.

Documentation Resources:

Support Resources:

Using phing for good - Unfuddle Add Repository and SVN Import Tasks

As you may be aware I have recently been playing with the excellent Agavi framework and it introduced me to the interesting phing tool.  Phing can be used to automate tasks with build files that are close to interoperable with Apache Ant, which uses XML files to configure builds.  The advantage phing has for us PHP users is that it is entirely written in PHP so extending it is as simple as adding a new class.

On a few recent projects I did just that when I need the ability to perform SVN Import and access Unfuddle’s API to create a new repository on the fly.  Essentially my build file was creating a new website using a CMS and then creates a new repository for it and imports the newly built CMS automatically.  This was all written to use Unfuddle’s SVN but the add repository task should be able to be used to create a new git repository as well.  The Unfuddle side of things was completed with refactoring and building upon David Winterbottom’s work, which was originally intended to send Unfuddle messages.

Please find the code hosted on github in my phing repo.

Agavi Release Candidate 1

Agavi Framework Logo

Agavi Framework Logo

A bit slow off the mark with this one but Agavi 1RC1 has been released and it is of course looking very nice. The 1.0 feature set is complete and potential bug fixes are the only things standing between now and 1.0 in earnest.  Features that I am particularly interested in include the recent refactoring of the configuration/routing files, the new validation interface and the addition of unit testing to the framework.

Agavi 1.0 Beta on XAMPP 1.7.0

To install the new XAMPP ensure you firstly uninstall and remove your current XAMPP folder. Upgrades are not supported with this version due to the differences one of which is the removal of PHP4 support from the XAMPP package.

I like to install agavi via the pear package that is available:

  1. Open a command prompt and navigate to your XAMPP directory eg. D:\xampp\php
  2. Execute:
    1. pear channel-discover pear.agavi.org
    2. pear config-set auto_discover 1
    3. pear config-set preferred_state beta
    4. pear install -a agavi/agavi
  3. Wait for a bit as it installs
  4. Execute the command agavi and you will get a phing error

To rectify the error we must complete a little bit of a hack to trick the agavi batch file into recognising our phings version is greater than 2.3.1. Navigate into your XAMPP PEAR folder (D:\xampp\php\PEAR\phing) and create a new directory called ‘etc’. Inside your ‘etc’ directory create a new text file called ‘VERSION.TXT’ containing the following text ‘Phing 2.3.3 BRANCH (2.3dev)’.

Try executing the agavi command on the command line again and you should have a successful response like:

D:\xampp\php>agavi

Agavi > status:

[echo] PHP:
[echo] Version: 5.2.8
[echo] Include path: .;D:xamppphppear
[echo]
[echo] Phing:
[echo] Version: Phing 2.3.3 BRANCH (2.3dev)
[echo]
[echo] Agavi:
[echo] Installation directory: D:xamppphppearagavi
[echo] Version: 1.0.0-beta6
[echo] URL: http://www.agavi.org
[echo]
[echo] Project:
[echo] (not found)
[echo]
[echo] For a list of possible build targets, call this script with the -l a
rgument.

D:\xampp\php>

Hope that helps you out and you can continue to follow the official tutorial.

Installing Agavi on XAMPP Windows

Having recently heard of the Agavi project from a web framework showdown at a PHP conference in the UK I have decided to trial it. My setup is a WinXP computer with a default install of the latest XAMPP which has thrown up some issues with installing and building Agavi. Please see my hints below to overcome these issues.

  1. Open a command prompt (type cmd in the run console)
  2. Navigate to your XAMMP PHP directory. Mine is C:\xampp-test\php
  3. Execute pear.bat channel-discover pear.agavi.org
  4. Execute pear.bat install agavi/agavi

Agavi is now installed! Now we just need a new default project to work from.

Agavi needs to be told where the phing batch file is stored.

  1. Edit the agavi.bat file in the XAMPP php directory. Mine is C:\xampp-test\php\agavi.bat
  2. Change set PHING_COMMAND=phing to contain the full absolute path to phing.bat which is in the XAMPP php folder. Mine looks like this: set PHING_COMMAND=C:\xampp-test\php\phing.bat

Begin setting up your project directory.

  1. Create a new directory in your XAMPP directory. Mine is C:xampp-testhtdocssimonholywell.com
  2. Create an empty text file called build.properties in the directory (this banishes a build error where phing fails if it cannot find the file)
  3. Open a command prompt and navigate to the new directory
  4. Execute agavi.bat project The agavi.bat file is stored in the XAMPP php folder. My command looked like this: C:\xampp-test\php\agavi.bat project
  5. Follow the prompts the installer gives you (hitting enter will supply the installer with the [default] value)

Agavi should now be setup for your project. View it in your browser to verify.