Skip to content
Add some extra tools to symfony
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


For now, there is no full documentation. However you can find some information here

* [swBreadcrumb]( "Working with symfony plugins breadcrumb") : Working with symfony plugins breadcrumb

* [swWidgetFormGMapAddress]( "How to use the swWidgetFormGMapAddress widget") : How to use the swWidgetFormGMapAddress widget

* [swToolboxFormHelper]( "Let's be more dynamic with sfForm") : 
Let's be more dynamic with sfForm (Ajax)

* [swFilterFunctionalTest]( "Functional Test Generation with symfony 1.2") : 
Functional Test Generation with symfony 1.2

* [sendMail]( "Send Mail with symfony 1.2") : Send Mail with symfony 1.2

# sendMail

This feature has been removed from symfony version 1.1 and 1.2. This will simulate the sendMail method
and add extras features :

* email decorator
* Zend_Mail Support
* Charset and Encoding
* variables assignement from the controller

This solution is based on Zend_Mail for more information please refer to the Zend Framework documentation
available at :

## Installation

* Install Zend Framework available at   
  you can also install the lib via svn (
  The lib must be installed into SF_ROOT_DIR/lib/vendor/
* Edit the app.yml file

            charset: utf-8                             # charset to use : utf-8, iso-8859-1, ...
            encoding: quoted-printable                 # 7bit, 8bit, quoted-printable, base64 (default : quoted-printable)
            transport:                                 # define which transport class to used
              # sample with Sendmail
              class: Zend_Mail_Transport_Sendmail      # Zend_Mail_Transport_Sendmail | Zend_Mail_Transport_Smtp
              parameters: ""
              # sample with Smtp
              class: Zend_Mail_Transport_Smtp          # Zend_Mail_Transport_Sendmail | Zend_Mail_Transport_Smtp
                - value 1
                - { auth: Plain|Crammd5|Login, username: yourusername, password: yourpassword }
            decorator:                                 # define the layout use in the mail
              enabled: off                             # on | off : set true if all your mail share the same layout
              directory: %SF_APP_TEMPLATE_DIR%         # where the layout is located, ie %SF_APP_TEMPLATE_DIR%
              template: email                          # name of the layout, automatically translate to name.FORMAT.php
            view:                                      # define the view class used to render the template
              class: swMailView
* Clear your cache

## Usage

        public finction executeConfirmPaiement()
          // [...]
          // create object in your controller
          $invoice = Doctrine::getTable('Invoice')->find(..);
          // call the email action
          $action->sendMail('yourModule', 'sendInvoice', array('invoice' => $invoice);
        public function executeSendInvoice(sfWebRequest $request)
          $mail = new swMail;
          $mail->setSubject('Your Invoice #'.$invoice->getReference());
          $mail->setFrom('', 'Billing Service');
          $mail->addTo($this->invoice->getEmail(), $this->invoice->getName());
          $this->mail = $mail;
You should have a least one template file : sendInvoiceSuccess.txt.php or sendInvoiceSuccess.html.php in your
module/templates folder.

If you want a specific layout around your email (like default header and footer), enable the decorator option
and create a 'email.txt.php' and/or 'email.html.php' inside the decorator directory.

# swToolboxHelper

## sw_t($title)
  * define the title of the current page
  * custom configuration : edit and add these lines to your app.yml
          page_title_enabled: true
          page_title_suffix: " - Thomas Rabaix"
## sw_insert_google_api

  * small helper to insert google api url
              google_api_key: your_key_here
              google_map_version: 2.x
              google_analytics: [ UA-KEY-ONE, UA-KEY-TWO]

# swUserContextCacheFilter

This class can replace the default cache handler class. The class always executes an user context action.

Let's take this example with an ecommerce website, you might want to cache the full action, however some parts are user specific.
So you can have a viewProduct action and a viewProduct_UserContext action in your actions.class.php

* viewProduct : execute page related action, get the product and other related information
* viewProduct_UserContext : execute user specific action for the current page, like testing if the product is already in the client's basket.

## Installation

* edit the filters.yml

          class: swUserContextCacheFilter
            condition: on # always set to on
Something went wrong with that request. Please try again.