Outils pour utilisateurs

Outils du site




Accès rapide:

Les livres Sensio Labs (buy or read online for free)


Ce site propose de mettre en relation des développeurs, des entreprises, des projets et des offres d'emploi en relation avec le framework Symfony. Et notamment une liste d'applications.


Symfony IRC

Blog des développeurs


Easy Unit Testing with Lime, the Test tool inside Symfony.

Comparaison Zend_Framework et Symfony

industrialisation de projets multi-sites

The sandbox is a pre-packaged symfony project. It is made for people who want to play with the framework.

Snippets tagged "symfony" sur prendreuncafe.com.


Quelques plugins qui ont attirés mon attention :


sfDoctrineGuardPlugin is a symfony plugin that provides authentication and authorization features above the standard security feature of symfony.
It gives you the model (user, group and permission objects) and the modules (backend and frontend) to secure your symfony application in a minute in a configurable plugin.

sfDoctrineUserPlugin provides a starting point for anyone needing a quick full user in any application. It creates a user which has a sfGuardUser. This user then has the following properties: sfGuardUser (Multiple Groups, Multiple permissions, username, password), sfUserUser ( Multiple Email Addresses, Multiple Addresses, Multiple Phone Numbers…)

Forms & Widgets

sfExtraWidgetsPlugin, is a complement of the symfony widgets. All widgets use the prototype javascript framework.

SWFUpload is a small JavaScript/Flash library to get the best of both worlds. It features the great upload capabilities of Flash and the accessibility and ease of HTML/CSS.

sfViewableFormPlugin Enhance you forms with forms.yml.

Routing & Co.

sfDomainRoutePlugin: Pass and retrieve parameters in the subdomain, Limit routes to certain domains or subdomains, Generate urls across subdomains.

sfOfflineFilterPlugin Ce plugin, vous permet de mettre hors ligne votre site, tout en continuant à le visiter si vous êtes connecté.

sfSimplePagePlugin allows you to manage like static pages with symfony. These page is rendered by symfony, so you can use view system of partial, component, helper…


sfCombinePlugin combines multiple JavaScript and CSS files into one JavaScript and one CSS file at runtime, in order to minimize the number of HTTP requests required to render a given page.

sfSuperCachePlugin writes your page cache somewhere under your root directory to allow your web server to serve them as fast as possible.

Dev tools

sfTaskExtraPlugin Adds tasks to your symfony command line to help streamline your workflow.

sfPhpunitPlugin creates stub classes for PHPUnit of classes in lib/model.

sfBugsPlugin allows you to easily send bugs from the Web Debug Toolbar for modules and actions. It's useful for testers to mark bugs for specific sections.

sfDoctrineGraphvizPlugin Adds a doctrine task that output database MCD and MLD schema using graphviz.

sfApplicationMapPlugin provides tasks to generate application-module-action structure images for your entire project using Graphviz. Useful at the designing stage of projects. Very useful to create brief overlook of a project.

mgI18nPlugin add a new transtalation panel into the debug web panel. The translation panel displays all source messages used in the current page, and a form to edit the target messages.


ckWebWervicePlugin: Server SOAP pour Symfony.

apostrophePlugin: Apostrophe is a content management system. Apostrophe is open source, and built upon the great work of other open source projects. That's why our apostrophePlugin is a plugin for the Symfony web application framework.

The philosophy of Apostrophe is that editing should be done “in context” as much as possible, keeping confusing modal interfaces to a minimum and always emphasizing good design principles and an intuitive user experience. When we are forced to choose between ease of use and a rarely used feature, we choose ease of use, or make it possible to discover that feature when you truly need it.

Sympal is an extension for Symfony that is specifically designed for building content based websites/applications.

i18nTranslatePlugin The i18nTranslatePlugin attempts to translate your words and sentences using Google Language Api.

sfEleAdminEmailPlugin The sfEleAdminEmailPlugin is a symfony plugin that provides a simple tool for email template administration and also an extension for SwiftMailer message class that allow the sending of formated templates.

sfWorkerPlugin manage workers from symfony requests. Here workers means external process which may be longer than a single http request. Like you spawn a process external to symfony which will goes on running after the http request which created it.

sfEzcWorkflowPlugin is a symfony plugin which allows you to create workflow-driven applications on symfony projects. Workflow definition and execution are handled by ezcWorkflow, therefore you need to install ezComponents first. This plugin provides an interface for admin workflows and executions (create, instantiate, resume and cancel an ezcWorkflow). Also, an input node which links the workflow execution with symfony actions is provided.



AMF Server with sfAmfPlugin. Plugin to handle AMF requests from Flex frontends. The plugin is currently based on the SabreAMF library. It makes the development and integration of Services easy.

About Timestamp

In the method Doctrine_Template_Listener_Timestampable::getTimestamp() there is:

  • type “date” = date($options['format'], time())
  • type “timestamp” = the same as type “date”
  • else = time() (an Unix timestamp)

Why it isn't like :

  • type “date” = date($options['format'], time())
  • type “timestamp” = time() (an Unix timestamp)

Ma question sur le forum: A "philosophic" question about timestamp in class Doctrine_Template_Listener_Timestampable

Suggable behavior

Q: Quand l'option canUpdate de Sluggable est à FALSE, je peux le mettre à jour sans générer d'erreur … Ce n'est pas normal ?! (la question sur symfony-users)
R: C'est normal, l'option “canUpdate” concerne la mise à jour ou non du “slug” quand l'un des “fields” est modifié. Cette option n'empêche en rien la modification manuelle (via un Form).

Si l'on souhaite modifier le Form d'Admin généré :

class MyModelForm extends BaseMyModelForm
 public function configure()
  // remove it
  //unset( $this->widgetSchema['slug'] );
  // or make it readonly
  $this->widgetSchema['slug']->setAttribute('readonly', true);

Timestampable behavior and generated admin form

Depuis la version 1.4, lorsque l'on génère les interfaces d'administration (symfony doctrine:generate-admin) pour un modèle avec le behavior Timestampable (actAs: Timestampable: ~), les champs “created_at” et “updated_at” sont générés dans le Form, ce qui est bien embêtant…

Du coup pour les supprimés, il faut modifier la définition du formulaire dans la classe qui étend le formulaire de base pour le modèle.

La classe “MaClasse” à modifier se trouve dans


supprimer les validators et les widgets:

public function configure()
  //Following code will remove Required validators from these fields.
  //following code will remove fields from form

Action's properties declaration

If a property is created in an action, all things work:

  public function executeIndex(sfWebRequest $request)
    $this->jobeet_jobs = Doctrine::getTable('JobeetJob')->createQuery('a')->execute();

But if I add a property's declaration, it does not work any more :

class jobActions extends sfActions
  public $jobeet_jobs = null;
  public function executeIndex(sfWebRequest $request)
    $this->jobeet_jobs = Doctrine::getTable('JobeetJob')->createQuery('a')->execute();

An execption is throwed :

Notice: Undefined variable: jobeet_jobs in D:\dev.www\Symfony\Jobeet\apps\frontend\modules\job\templates\indexSuccess.php

What's the reason of that ???


This is deliberate.
Declared action attributes are regarded as private to the template i.e. they're expected to be used just for the action itself.
If they are undeclared, they are made available to the template by symfony.

Surcharge des plugins

Les plugins symfony ont la particularité de pouvoir être surchargés dans chaque application avec une granularité relativement fine. Par exemple, il est facile de ne surcharger qu’une action, qu’un template ou qu’un partiel.

Pour permettre la surcharge la plus souple possible, ce découpage des classes doit être généralisé au sein des plugins (actions, components, model, utilitaires,… ). Il s’agit de la méthode utilisée pour les plugins publics développés pour symfony, et du code généré par Propel ou Doctrine. Pour simplifier la création de modules dans les plugins suivant cette convention, on peut gagner du temps en utilisant le plugin sfTaskExtraPlugin et la tâche generate:plugin-module, qui pré-générera les classes d’actions.

Lire la suite: industrialisation de projets multi-sites/Capitalisation du code

Log and Logging

How to write to log:

 // in an action
 $this->logMessage($message, $level);
 // in a template
 <?php use_helper('Debug') ?>
 <?php echo log_message($message, $level) ?>
 // anywhere in your application

To Check: if you turn off the logging and change the logging level to 'err', then getInstance()→getLogger()→debug() will fail with an error.

Form and Widget

order fields in form

 // sfWidgetFormSchema::setPositions(array $positions)
 // ATTENTION: Positions array must include all fields
 $this->getWidgetSchema()->setPositions( array('name','email') );
 // sfWidgetFormSchema::moveField($field, $action, $pivot = null)
 $this->getWidgetSchema()->moveField('name', sfWidgetFormSchema::FIRST );
 $this->getWidgetSchema()->moveField('email', sfWidgetFormSchema::AFTER, 'name' );

Custom Widget

Combining input and choice widget (class myWidgetFormInputTextAndChoice extends sfWidgetForm)

Dynamically add fields


Symfony en serveur SOAP

The ckWebServicePlugin allows you to build a webservice api for your symfony applications. It comes with a powerful and easy to use wsdl generator, which creates WS-I compliant wsdl files for a maximum of interopability with PHP, .NET and Java clients.

Plus vieux : Soap server by Fuad Arafa on 2007-01-18


Talking about the plugin on the Symfony forum

J'ai essayé ce plugin en l'installant sur une sandbox_1.2 et il y a quelques précisions à apporter au README :

Mettre en commentaire le web_debug dans filters.yml. C'est un problème cette modif de config est pour toute l'application au lieu d'être propre à l'environnement.

Il faut mettre le block “soap_parameter” entre “security” et “cache”, si on le met à la fin du fichier ça ne fonctionne pas : le filtre ckSoapParameterFilter n'est pas inscrit dans la chaîne.

    encoding: utf-8
    soap_version: <?php echoln(SOAP_1_2); ?>

in app/config/php/yml :

  soap.wsdl_cache_enabled: 0

Problème de sérialisation des objets Propel.
Le Problème et la solution : http://forum.symfony-project.org/index.php/m/81012/#msg_81012

Data Access

Symfony est livrée avec les ORMs Propel et Doctrine. La v1.2 semble préconiser Doctrine.

Des exemples de requêtes en Propel et Doctrine

Multi databases

Arbre de données

Ou gestion de catégories ;-)

Doctrine NestedSet

Un peu vieux:

Many-to-many relationships

Template engine

Les templates de Symfony sont en php. Est-ce intéressant d'utiliser un moteur de template (Smarty, PhpTal, …) ?

  • Avantages
    • Exécution plus rapide: pas de sur-couche d'interprétation, moins de transformation.
  • Inconvénients
    • Risque de déport de logique métier dans les templates.
  • Divers
    • Les Helpers génèrent du Html, l'édition des pages en wysiwyg s'en trouve limitée.

Du coup l'usage d'un moteur de template n'est pas très pertinent. Autant conserver les originaux html dans un coin, et les découper à l'intégration dans Symfony.

Dev tools

informatique/php/symfony.txt · Dernière modification : 27/08/2016 16:52 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki