1. Introduction
    1. About Agavi
    2. MVC in Agavi
    3. Overview of Agavi
    4. Overview of Application Execution Flow
    5. A Word About Actions
    6. Application filesystem layout
    7. Overview of application configuration
  2. Setting Up The Initial Application
    1. Installing Agavi
    2. Creating an Agavi Project
    3. Finishing The Setup
    4. Finishing The Basic Setup
    5. Installing a New Copy of Your Application
  3. Adding First Code
    1. Creating A New module
    2. Creating A New Action
    3. Tying Things Together — An Introduction To Routing
    4. Fixing The Bloggie Routing
    5. Accessing Request Parameters and Validation Basics
    6. Handling Validation Errors
  4. Putting The M in MVC
    1. Creating A New Model
    2. Adapting The Actions and Views
    3. Custom Validators
  5. Polishing It Up
    1. Layers and Layouts
    2. Applying Our Layout
    3. What Are Slots?
    4. Adding The Post's Title To The URL
    5. Routing Callbacks
    6. Using Callbacks for the Title in URLs
  6. Connecting to a database
    1. The Database Manager
  7. Handling Output Variants
    1. Output Types
    2. Exception Templates
    3. Generating an RSS Feed
  8. Form Processing
    1. Adding a Post
    2. Editing a Post
    3. The Form Population Filter (FPF)
  9. Creating a User Authentication System
  10. Adding To The Master Template

Finishing The Setup

Once the project is created some setup tasks are still left to do.

Setting Up Your Editor or IDE

While this may seem trivial it is still important to configure your editor properly. Eclipse for example tends to use a local encoding for files instead of UTF-8. We strongly recommend using UTF-8 for various reasons, so now would be a good time to change that and have your favorite editor use utf8 as charset.

Removing The Welcome Page

The welcome page only serves to check whether the creation of the project was completed successfully, this module is unneeded, so it can be removed. To do so, remove the Welcome module by deleting the directory bloggie/app/modules/Welcome. You probably won't need the image resources for the welcome page any more, so remove them by deleting bloggie/pub/welcome. Remove the route pointing to the welcome page from bloggie/app/config/routing.xml, it's the first one in the file, the comment line should point you right at it.

After you've done that you should see a nearly blank page displaying "Index".

Adding Version Control

On any serious project, you should consider using a version control system such as subversion. Now that you have the base of your project this would be an ideal time to to do the initial commit. If you choose not to use a version control system for your project for what ever reason, it's recommended that you continue to read this section.

We won't cover the basics of version control in this tutorial or pick a Source Code Manager (SCM) for you, however there's a few things to note that apply to all SCM systems. There are some files in your project that contain information that depends on the environment you're running the application in. The index.php dispatcher file contains the name of the environment in the bootstrap call, and if you chose to generate the .htaccess file, it contains the path relative to the web root. If you check those files in you always have locally modified files in your working copy and you need to be extra careful not to check those in, as it would break other developers working copies or even your production environment. The best practice for all version control systems is not to add those files to version control at all but instead add a template file that is copied and adapted as needed. The agavi project generator already added the template files for .htaccess and index.php to bloggie/dev/pub/ so all you need to do is take care that you don't check in the files bloggie/pub/index.php and bloggie/pub/.htaccess. Instead add them to your SCMs ignore mechanism, for svn set the svn:ignore property accordingly, for darcs add those files to _darcs/prefs/boring etc.

Oh, and while we're at it: add all files in bloggie/app/cache/config to the ignore list as well.

Tip: There is another way of handling the dispatcher file. By reading the environment from a server variable such as $_SERVER[AGAVI_ENVIRONMENT], the server admin can set the environment for you and you can check in the dispatcher file. However, this does not apply to the generated .htaccess file. This way of handling the environment dependency does have it's ups and downs. While it removes the step of manually copying the dispatcher file it forces anyone to use the same dispatcher file. You cannot have multiple environments on the same server without your server admin setting a variable for a specific path and more important, you cannot use any of the config directives that need to be set manually in the dispatcher file. We'll cover those later though, so for the time being, stick to the recommended mechanism of copying the dispatcher file.