PHP Symfony

From HaFrWiki42
Jump to navigation Jump to search

Symfony is a framework for PHP [1]. The symfony framework is often used in combination with Propel and Doctrine.


Jobeet

Assuming Symfony is installed in (./lib/vendorsymfony). [2][3]

Check & Create

# Check configuration
$ php lib/vendor/symfony/data/bin/check_configuration.php
# command line|Command Line to display the version (note the capital V):
$ php lib/vendor/symfony/data/bin/symfony -V

The cli command generates the directory structure:

Directory Description
apps/ Hosts all project applications
cache/ The files cached by the framework
config/ The project configuration files
lib/ The project libraries and classes
log/ The framework log files
plugins/ The installed plugins
test/ The unit and functional test files
web/ The web root directory (see below)
# From the jobeet directory, run the symfony generate:project task to actually create the symfony project:
$ php lib/vendor/symfony/data/bin/symfony generate:project jobeet

This generates the symphony shortcut which contains php code for running the symphony task.

# Generate the contend
$ php symfony generate:app --escaping-strategy=on --csrf-secret=UniqueSecret frontend

Generates:

Directory Description
config/ The application configuration files
lib/ The application libraries and classes
modules/ The application code (MVC)
templates/ The global template files

In MAMP Pro creates a virtual Web Server and make an alias in the 'Customized virtual host general settings of 'Hosts' => 'Advanced'.

Alias /sf /Sources/php/jobeet/lib/vendor/symfony/data/wef/sf

Now try tp connect: using the following URLs:

Database

First decide which plugin to use:

  • Propel
  • Doctrine
# config/ProjectConfiguration.class.php.
public function setup()
{
  $this->enablePlugins(array('sfDoctrinePlugin'));
  // $this->enablePlugins(array('sfPropelPlugin'));
}
# We need to tell symfony to use this database for the Jobeet project:
# param 1 - DSN
# param 2 - Username
# param 3 - Password
$ php symfony configure:database "mysql:host=localhost;dbname=jobeet" root mYsEcret

And with the schema.yml:

Db Generation

Doctrine Propel
Based on the statements:
  • First in order to generate the SQL you must build your models from your schema files.
    • $ php symfony doctrine:build --model
  • generate and insert the SQL.
    • $ php symfony doctrine:build --sql
  • run the doctrine:insert-sql task:
    • $ php symfony doctrine:insert-sql
  • Generate the PHP classes
    • $ php symfony doctrine:build-model

The below snippet shows the results:

/Sources/php/jobeet:HaFrMpro$ php symfony cc
>> cache     Clearing cache type "all" for "frontend" app and "cli" env
>> file+     /Sources/PHP/jobeet/data/frontend_cli-cli.lck
>> chmod 777 /Sources/PHP/jobeet/data/frontend_cli-cli.lck
>> file-     /Sources/PHP/jobeet/cache/frontend/cli/config/config_settings.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/cli/config/config_config_handlers.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/cli/config/config_app.yml.php
>> file-     /Sources/PHP/jobeet/data/frontend_cli-cli.lck
>> cache     Clearing cache type "all" for "frontend" app and "dev" env
>> file+     /Sources/PHP/jobeet/data/frontend_dev-cli.lck
>> chmod 777 /Sources/PHP/jobeet/data/frontend_dev-cli.lck
>> file-     /Sources/PHP/jobeet/cache/frontend/dev/config/config_settings.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/dev/config/config_config_handlers.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/dev/config/config_app.yml.php
>> file-     /Sources/PHP/jobeet/data/frontend_dev-cli.lck
>> cache     Clearing cache type "all" for "frontend" app and "prod" env
>> file+     /Sources/PHP/jobeet/data/frontend_prod-cli.lck
>> chmod 777 /Sources/PHP/jobeet/data/frontend_prod-cli.lck
>> file-     /Sources/PHP/jobeet/cache/frontend/prod/config/config_settings.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/prod/config/config_config_handlers.yml.php
>> file-     /Sources/PHP/jobeet/cache/frontend/prod/config/config_app.yml.php
>> file-     /Sources/PHP/jobeet/data/frontend_prod-cli.lck
/Sources/php/jobeet:HaFrMpro$ ./symfony plugin:publish-assets
>> plugin    Configuring plugin - sfDoctrinePlugin
/Sources/php/jobeet:HaFrMpro$ rm config/propel.ini
rm: config/propel.ini: No such file or directory
/Sources/php/jobeet:HaFrMpro$ la config/
total 32
-rw-r--r--@ 1 HaFrMpro  wheel  337 Nov  1 10:06 ProjectConfiguration.class.php
-rw-r--r--@ 1 HaFrMpro  wheel  147 Nov  1 09:38 databases.yml
drwxr-xr-x  3 HaFrMpro  wheel  102 Oct 31 16:15 doctrine
-rw-r--r--@ 1 HaFrMpro  wheel   62 Nov  1 09:42 properties.ini
-rw-r--r--  1 HaFrMpro  wheel  128 Oct 31 16:15 rsync_exclude.txt
/Sources/php/jobeet:HaFrMpro$ rm config/schema.yml
rm: config/schema.yml: No such file or directory
/Sources/php/jobeet:HaFrMpro$ rm config/databases.yml 
remove config/databases.yml? y
/Sources/php/jobeet:HaFrMpro$ php symfony configure:database "mysql:host=localhost;dbname=Jobeet" root root
/Sources/php/jobeet:HaFrMpro$ php symfony doctrine:build-model
>> doctrine  generating model classes
>> file+     /private/var/folders/62/8jl5b0xd1d5_syhb5z1v5x380000gn/T/doctrine_schema_32603.yml
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetAffiliateTable.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetCategory.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetCategoryAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetCategoryAffiliateTable.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetCategoryTable.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetJob.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/JobeetJobTable.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetCategory.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetCategoryAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetJob.class.php
>> autoload  Resetting application autoloaders
/Sources/php/jobeet:HaFrMpro$ php symfony doctrine:build-sql
>> doctrine  generating sql for models
>> dir+      /Sources/PHP/jobeet/data/sql
>> doctrine  Generated SQL successfully for models
/Sources/php/jobeet:HaFrMpro$ php symfony doctrine:insert-sql
>> doctrine  creating tables
>> doctrine  created tables successfully
/Sources/php/jobeet:HaFrMpro$ ./symfony doctrine:build-model
>> doctrine  generating model classes
>> file+     /private/var/folders/62/8jl5b0xd1d5_syhb5z1v5x380000gn/T/doctrine_schema_13722.yml
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetCategory.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetCategoryAffiliate.class.php
>> tokens    /Sources/PHP/jobeet/lib/model/doctrine/base/BaseJobeetJob.class.php
>> autoload  Resetting application autoloaders
>> file-     /Sources/PHP/jobeet/cache/frontend/dev/config/config_autoload.yml.php
/Sources/php/jobeet:HaFrMpro$ 

 

Database Fixtures

Each time symfony creates the tables in the database, all the data are lost. To populate the database with some initial data, we could create a PHP script, or execute some SQL statements with the mysql program. But as the need is quite common, there is a better way with symfony: create YAML files in the data/fixtures/ directory and use the doctrine:data-load task to load them into the database.

To load the fixture into the database use:

# Loading the initial data into the database is as simple as running the doctrine:data-load task:
$ php symfony doctrine:data-load
$ php symfony doctrine:build-all-reload
# data/fixtures/categories.yml
JobeetCategory:
  design:
    name: Design
  programming:
    name: Programming
  manager:
    name: Manager
  administrator:
    name: Administrator
 
# data/fixtures/jobs.yml
JobeetJob:
  job_sensio_labs:
    JobeetCategory: programming
    type:         full-time
    company:      Sensio Labs
    logo:         sensio-labs.gif
    url:          http://www.sensiolabs.com/
    position:     Web Developer
    location:     Paris, France
    description:  |
      You've already developed websites with symfony and you want to work
      with Open-Source technologies. You have a minimum of 3 years
      experience in web development with PHP or Java and you wish to
      participate to development of Web 2.0 sites using the best
      frameworks available.
    how_to_apply: |
      Send your resume to fabien.potencier [at] sensio.com
    is_public:    true
    is_activated: true
    token:        job_sensio_labs
    email:        job@example.com
    expires_at:   '2010-10-10'
 
  job_extreme_sensio:
    JobeetCategory:  design
    type:         part-time
    company:      Extreme Sensio
    logo:         extreme-sensio.gif
    url:          http://www.extreme-sensio.com/
    position:     Web Designer
    location:     Paris, France
    description:  |
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
      eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
      enim ad minim veniam, quis nostrud exercitation ullamco laboris
      nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
      in reprehenderit in.
 
      Voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Excepteur sint occaecat cupidatat non proident, sunt in culpa
      qui officia deserunt mollit anim id est laborum.
    how_to_apply: |
      Send your resume to fabien.potencier [at] sensio.com
    is_public:    true
    is_activated: true
    token:        job_extreme_sensio
    email:        job@example.com
    expires_at:   '2010-10-10'

Basic Web CRUD

Symfony is able to automatically generate a module for a given model that provides basic manipulation features:

  • $ php symfony doctrine:generate-module --with-show --non-verbose-templates frontend job JobeetJob

Configuration Principles

For many symfony configuration files, the same setting can be defined at different levels:

Configuration Location Description
Default Inside the framework Default configuration
Global config/ Global configuration for a project
Local Foo apps apps/<Foo>/config Local configuration for an application
Local restricted to a module apps/<Foo>/<MODULE>/config/ Local configuration restricted to a module

As a rule of thumb, when something is configurable via a configuration file, the same can be accomplished with PHP code.
Instead of creating a view.yml file for the job module for instance, you can also use the use_stylesheet() helper' to include a stylesheet from a template:

<?php use_stylesheet('main.css') ?>

Choosing between one method or the other is really a matter of taste. The view.yml file provides a way to define things for all actions of a module, which is not possible in a template, but the configuration is quite static.
On the other hand, using the use_stylesheet() helper is more flexible and moreover, everything is in the same place:

  • the stylesheet definition
  • the HTML code.

For Jobeet, we will use the use_stylesheet() helper, so you can remove the view.yml' we have just created and update the job templates with the use_stylesheet() calls:

<!-- apps/frontend/modules/job/templates/indexSuccess.php -->
<?php use_stylesheet('jobs.css') ?>
 
<!-- apps/frontend/modules/job/templates/showSuccess.php -->
<?php use_stylesheet('job.css') ?>

Symfony and AJAX

More information

top

  • Doctrine Project is the home of a selected set of PHP libraries primarily focused on providing persistence services and related functionality. Its prize projects are a Object Relational Mapper and the Database Abstraction Layer it is built on top of. You can read more about the projects below or view a list of all projects.
    • Doctrine OrientDB, Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence for PHP objects.
    • Doctrine Abstraction Layer, with many features for database schema introspection, schema management and PDO abstraction.
    • Doctrine Migrations additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and powerful tool.
    • Doctrine ORM, Object relational mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
    • Object relational mapper (ORM) for PHP that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
    • The Doctrine Common project is a library that provides extensions to core PHP functionality.
    • Doctrine MongoDB Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence for PHP objects.
    • Doctrine CouchDB Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence for PHP objects.
    • Doctrine PHPCR Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence for PHP objects.
  • Propel is an open-source Object-Relational Mapping (ORM) for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.

Symfony 1.x Documentation

Configuration

  • Reference Symfony 1.4 Introduction. Using a full-stack framework like symfony is one of the easiest ways to increase your speed and efficiency as a web developer.
  • Refrence Symfony 1.4 The YAML format. YAML is a simple language that describes data. Like PHP, it has a syntax for simple types like strings, booleans, floats, or integers.
  • Reference Symfony 1.4 Configuration File Principles. Symfony configuration files are based on a common set of principles and share some common properties. This section describes them in detail, and acts as a reference for other sections describing YAML configuration files.
  • Reference Symfony 1.4 The settings.yml Configuration File is environment-aware, and benefits from the configuration cascade mechanism.
  • Reference Symfony 1.4 The factories.yml Configuration file. Factories are core objects needed by the framework during the life of any request. They are configured in the factories.yml configuration file and always accessible via the sfContext object.
  • Reference Symfony 1.4 The generator.yml Configuration file allows the creation of a backend interface for your model classes. It works whether you use Propel or Doctrine as your ORM.
  • Reference Symfony 1.4 The databases.yml Configuration file allows for the configuration of the database connection.
  • Reference Symfony 1.4 The security.yml Configuration file describes the authentication and authorization rules for a symfony application.
  • Reference Symfony 1.4 The cache.yml Configuration file describes the cache configuration for the view layer. This configuration file is only active if the cache setting is enabled in settings.yml.
  • Reference Symfony 1.4 The routing.yml Configuration file allows the definition of routes.
  • Reference Symfony 1.4 The app.yml configures application specific settings.
  • Reference Symfony 1.4 The filters.yml Configuration file describes the filter chain to be executed for every request.
  • Reference Symfony 1.4 The view.yml configures the view-layer.
  • Reference Symfony 1.4 The autoload.yml configuration determines which directories need to be autoloaded by Symfony. Each directory is scanned for PHP classes and interfaces.
  • Reference Symfony 1.4 The config_handlers.yml describes the configuration handler classes used to parse and interpret all other YAML configuration files.
  • Reference Symfony 1.4 The core_compile.yml describes the PHP files that are merged into one big file in the prod environment, to speed up the time it takes for symfony to load. By default, the main symfony core classes are defined in this configuration file.
  • Reference Symfony 1.4 The module.yml configuration file allows the configuration of a module.

Events

  • Reference Symfony 1.4 Events. The Symfony core components are decoupled thanks to an sfEventDispatcher object. The event dispatcher manages the communication between core components.

Tasks / CLI

  • Reference Symfony 1.4 Tasks. The framework comes bundled with a command line interface (CLI) tool. Built-in tasks allow the developer to perform a lot of fastidious and recurrent tasks in the life of a project.

Forms

  • Form Creation, A form is made of fields like hidden inputs, text inputs, select boxes, and checkboxes.
  • Form Validation, The validation of the user-given data.
  • Form for Web Designers enables the developer to customise the presentation of a web-form.
  • Propel Integration In a Web project, most forms are used to create or modify model objects. These objects are usually serialized in a database thanks to an Object Relational Mapping (ORM).
  • Internationalization and Localization A lot of popular Web applications are available in several languages, and sometimes, they are even customized based on the user culture. Symfony comes with a built-in framework that eases the management of these features (see chapter "I18n And L10n" (/book/1_2/13-I18n-and-L10n) of the symfony book).
  • Doctrine Integration Another ORM.
  • Widgets The Symfony form framework comes bundled with a lot of useful widgets. These widgets cover the common needs of most projects.
  • Validators The symfony form framework comes bundled with a lot of useful validators. These validators cover the common needs of most projects. This chapter describes the default form validators bundled with symfony. We have also included the validators from the sfPropelPlugin, and sfDoctrinePlugin plugins, as these plugins are supported by the core team and contain some very useful validators.

Symfony API

The Symfony API Classes. To find the methods anf function see the original page at Symfony API.

Action

Name Description
sfAction sfAction executes all the logic for the current request.
sfActions sfActions executes all the logic for the current request.
sfActionStack sfActionStack keeps a list of all requested actions and provides accessor
sfActionStackEntry sfActionStackEntry represents information relating to a single sfAction request during a single HTTP request.
sfComponent sfComponent.
sfComponents sfComponents.

Addon

Name Description
sfData This class defines the interface for interacting with data, as well
sfPager sfPager class.
fPropel Initialization for propel and i18n propel integration.
sfPropelPager This class is the Propel implementation of sfPager. It interacts with the propel record set and

Autoload

Name Description
sfAutoload sfAutoload class.
sfAutoloadAgain Autoload again for dev environments.
sfCoreAutoload sfCoreAutoload class.
sfSimpleAutoload sfSimpleAutoload class.

Behavior

Name Description
SfPropelBehaviorBase Base behavior class.
SfPropelBehaviorI18n Internationalizes Propel models.
SfPropelBehaviorI18nTranslation Translation behavior.
SfPropelBehaviorSymfony A database behavior that adds default symfony behaviors.
SfPropelBehaviorSymfonyBehaviors Adds support for symfony's {@link sfMixer} behaviors.
SfPropelBehaviorTimestampable A timestampable implementation BC with symfony <= 1.2.

Cache

  • sfAPCCache: Cache class that stores cached content in APC.
  • sfCache: sfCache is an abstract class for all cache classes in symfony.
  • sfEAcceleratorCache: Cache class that stores cached content in EAccelerator.
  • sfFileCache: Cache class that stores content in files.
  • sfFunctionCache: This class can be used to cache the result and output of any PHP callable (function and method calls).
  • sfMemcacheCache: Cache class that stores cached content in memcache.
  • sfNoCache: Cache class that does nothing.
  • sfSQLiteCache: Cache class that stores cached content in a SQLite database.
  • sfXCacheCache: Cache class that stores cached content in XCache.

Command

  • sfAnsiColorFormatter: sfAnsiColorFormatter provides methods to colorize text to be displayed on a console.
  • sfCommandApplication: sfCommandApplication manages the lifecycle of a CLI application.
  • sfCommandArgument: Represents a command line argument.
  • sfCommandArgumentSet: Represent a set of command line arguments.
  • sfCommandManager: Class to manage command line arguments and options.
  • sfCommandOption: Represents a command line option.
  • sfCommandOptionSet: Represent a set of command line options.
  • sfFormatter: sfFormatter provides methods to format text to be displayed on a console.
  • sfPhing: @package symfony
  • sfSymfonyCommandApplication: sfSymfonyCommandApplication manages the symfony CLI.

Config

  • sfApplicationConfiguration: sfConfiguration represents a configuration for a symfony application.
  • sfAutoloadConfigHandler: @package symfony
  • sfCacheConfigHandler: sfCacheConfigHandler allows you to configure cache.
  • sfCompileConfigHandler: sfCompileConfigHandler gathers multiple files and puts them into a single file.
  • sfConfig: sfConfig stores all configuration information for a symfony application.
  • sfConfigCache: sfConfigCache allows you to customize the format of a configuration file to
  • sfConfigHandler: sfConfigHandler allows a developer to create a custom formatted configuration
  • sfDatabaseConfigHandler: sfDatabaseConfigHandler allows you to setup database connections in a
  • sfDefineEnvironmentConfigHandler: @package symfony
  • sfFactoryConfigHandler: sfFactoryConfigHandler allows you to specify which factory implementation the
  • sfFilterConfigHandler: sfFilterConfigHandler allows you to register filters with the system.
  • sfGeneratorConfigHandler: sfGeneratorConfigHandler.
  • sfPluginConfiguration: sfPluginConfiguration represents a configuration for a symfony plugin.
  • sfPluginConfigurationGeneric: sfPluginConfigurationGeneric represents a configuration for a plugin with no configuration class.
  • sfProjectConfiguration: sfProjectConfiguration represents a configuration for a symfony project.
  • sfPropelPluginConfiguration: sfPropelPlugin configuration.
  • sfRootConfigHandler: sfRootConfigHandler allows you to specify configuration handlers for the
  • sfRoutingConfigHandler: @package symfony
  • sfSecurityConfigHandler: sfSecurityConfigHandler allows you to configure action security.
  • sfSimpleYamlConfigHandler: sfSimpleYamlConfigHandler allows you to load simple configuration files formatted as YAML.

sfViewConfigHandler: sfViewConfigHandler allows you to configure views. sfYamlConfigHandler: sfYamlConfigHandler is a base class for YAML (.yml) configuration handlers.

Controller

  • sfController: sfController directs application flow.
  • sfFrontWebController: sfFrontWebController allows you to centralize your entry point in your web
  • sfWebController: sfWebController provides web specific methods to sfController such as, url redirection.

Database

  • sfDatabase: sfDatabase is a base abstraction class that allows you to setup any type of
  • sfDatabaseManager: sfDatabaseManager allows you to setup your database connectivity before the
  • sfDoctrineConnectionProfiler: Connection profiler.
  • sfMySQLDatabase: sfMySQLDatabase provides connectivity for the MySQL brand database.
  • sfPDODatabase: sfPDODatabase provides connectivity for the PDO database abstraction layer.
  • sfPostgreSQLDatabase: sfPostgreSQLDatabase provides connectivity for the PostgreSQL brand database.
  • sfPropelDatabase: A symfony database driver for Propel.

Debug

  • sfDebug: sfDebug provides some method to help debugging a symfony application.
  • sfWebDebug: sfWebDebug creates debug information for easy debugging in the browser.
  • sfWebDebugPanel: sfWebDebugPanel represents a web debug panel.
  • sfWebDebugPanelCache: sfWebDebugPanelCache adds a panel to the web debug toolbar with a link to ignore the cache
  • sfWebDebugPanelConfig: sfWebDebugPanelConfig adds a panel to the web debug toolbar with the current configuration.
  • sfWebDebugPanelDoctrine: sfWebDebugPanelDoctrine adds a panel to the web debug toolbar with Doctrine * information.
  • sfWebDebugPanelLogs: sfWebDebugPanelLogs adds a panel to the web debug toolbar with log messages.
  • sfWebDebugPanelMailer: sfWebDebugPanelMailer adds a panel to the web debug toolbar with sent emails.
  • sfWebDebugPanelMemory: sfWebDebugPanelMemory adds a panel to the web debug toolbar with the memory used by the script.
  • sfWebDebugPanelPropel: sfWebDebugPanelPropel adds a panel to the web debug toolbar with Propel information.
  • sfWebDebugPanelSymfonyVersion: sfWebDebugPanelSymfonyVersion adds a panel to the web debug toolbar with the symfony version.
  • sfWebDebugPanelTimer: sfWebDebugPanelTimer adds a panel to the web debug toolbar with timer information.
  • sfWebDebugPanelView: sfWebDebugPanelView adds a panel to the web debug toolbar with information about the view layer.

Default

  • lime_symfony:
  • sfFakeRenderingFilter:
  • sfMySQLiDatabase: sfMySQLiDatabase provides connectivity for the MySQL brand database.
  • sfPhingListener:
  • sfValidatorFDToken:
  • sfValidatorFDTokenFilter:
  • sfValidatorFDTokenLeftBracket:
  • sfValidatorFDTokenOperator:
  • sfValidatorFDTokenRightBracket:

Event dispatcher

  • sfEvent: sfEvent.
  • sfEventDispatcher: sfEventDispatcher implements a dispatcher object.

Exception

  • sfCacheException: sfCacheException is thrown when ConfigCache fails to execute properly.
  • sfCommandArgumentsException: sfCommandException is thrown when an error occurs in a task.
  • sfCommandException: sfCommandException is thrown when an error occurs in a task.
  • sfConfigurationException: sfConfigurationException is thrown when the framework finds an error in a
  • sfControllerException: sfControllerException is thrown when a requested Controller implementation
  • sfDatabaseException: sfDatabaseException is thrown when a database related error occurs.
  • sfError404Exception: sfError404Exception is thrown when a 404 error occurs in an action.
  • sfException: sfException is the base class for all symfony related exceptions and
  • sfFactoryException: sfFactoryException is thrown when an error occurs while attempting to create
  • sfFileException: sfFileException is thrown when an error occurs while moving an uploaded file.
  • sfFilterException: sfFilterException is thrown when an error occurs while attempting to initialize
  • sfForwardException: sfForwardException is thrown when an error occurs while attempting to forward
  • sfInitializationException: sfInitializationException is thrown when an initialization procedure fails.
  • sfParseException: sfParseException is thrown when a parsing procedure fails to complete
  • sfRenderException: sfRenderException is thrown when a view's pre-render check fails.
  • sfSecurityException: sfSecurityException is thrown when a security related error occurs.
  • sfStopException: sfStopException is thrown when you want to stop action flow.
  • sfStorageException: sfStorageException is thrown when a requested sfStorage implementation doesn't
  • sfViewException: sfViewException is thrown when an error occurs in a view.


Filter

  • sfBasicSecurityFilter: sfBasicSecurityFilter checks security by calling the getCredential() method
  • sfCacheFilter: sfCacheFilter deals with page caching and action caching.
  • sfCommonFilter: sfCommonFilter automatically adds javascripts and stylesheets information in the sfResponse content.
  • sfExecutionFilter: sfExecutionFilter is the last filter registered for each filter chain. This
  • sfFilter: sfFilter provides a way for you to intercept incoming requests or outgoing responses.
  • sfFilterChain: sfFilterChain manages registered filters for a specific context.
  • sfRenderingFilter: sfRenderingFilter is the last filter registered for each filter chain.

Form

  • sfForm: sfForm represents a form.
  • sfFormDoctrine: sfFormDoctrine is the base class for forms based on Doctrine objects.
  • sfFormField: sfFormField represents a widget bind to a name and a value.
  • sfFormFieldSchema: sfFormFieldSchema represents an array of widgets bind to names and values.
  • sfFormFilter: sfFormFilter represents a form that acts as a filter.
  • sfFormFilterDoctrine: sfFormFilterDoctrine is the base class for filter forms based on Doctrine objects.
  • sfFormFilterPropel: sfFormFilterPropel is the base class for filter forms based on Propel objects.
  • sfFormObject: Base class for forms that deal with a single object.
  • sfFormPropel: sfFormPropel is the base class for forms based on Propel objects.
  • sfFormSymfony: Extends the form component with symfony-specific functionality.

Generator

  • sfDoctrineFormFilterGenerator: Doctrine filter form generator.
  • sfDoctrineFormGenerator: Doctrine form generator.
  • sfGenerator: sfGenerator is the abstract base class for all generators.
  • sfGeneratorManager: sfGeneratorManager helps generate classes, views and templates for scaffolding, admin interface, ...
  • sfModelGenerator: Model generator.
  • sfModelGeneratorConfiguration: Model generator configuration.
  • sfModelGeneratorConfigurationField: Model generator field.
  • sfModelGeneratorHelper: Model generator helper.
  • sfPropelFormFilterGenerator: Propel filter form generator.
  • sfPropelFormGenerator: Propel form generator.

Helper

  • AssetHelper: AssetHelper.
  • CacheHelper: CacheHelper.
  • DateHelper: DateHelper.
  • EscapingHelper: The functions are primarily used by the output escaping component.
  • HelperHelper: HelperHelper.
  • I18NHelper: I18NHelper.
  • JavascriptBaseHelper: JavascriptBaseHelper.
  • NumberHelper: NumberHelper.
  • PartialHelper: PartialHelper.
  • TagHelper: TagHelper defines some base helpers to construct html tags.
  • TextHelper: TextHelper.
  • UrlHelper: UrlHelper.

i18n

  • sfChoiceFormat: sfChoiceFormat class.
  • sfCultureInfo: sfCultureInfo class.
  • sfDateFormat: sfDateFormat class.
  • sfDateTimeFormatInfo: Defines how DateTime values are formatted and displayed, depending
  • sfI18N: sfI18N wraps the core i18n classes for a symfony context.
  • sfI18nApplicationExtract: @package symfony
  • sfI18nExtract: @package symfony
  • sfI18nExtractorInterface: @package symfony
  • sfI18nModuleExtract: @package symfony
  • sfI18nPhpExtractor: @package symfony
  • sfI18nYamlExtractor: @package symfony
  • sfI18nYamlGeneratorExtractor: @package symfony
  • sfI18nYamlValidateExtractor: @package symfony
  • sfIMessageSource: sfIMessageSource interface.
  • sfMessageFormat: sfMessageFormat class.
  • sfMessageSource: Abstract sfMessageSource class.
  • sfMessageSource_Aggregate: sfMessageSource_Aggregate aggregates several message source objects.
  • sfMessageSource_Database: sfMessageSource_Database class.
  • sfMessageSource_File: sfMessageSource_File class.
  • sfMessageSource_gettext: sfMessageSource_gettext class.
  • sfMessageSource_MySQL: sfMessageSource_MySQL class.
  • sfMessageSource_SQLite: sfMessageSource_SQLite class.
  • sfMessageSource_XLIFF: sfMessageSource_XLIFF class.
  • sfNumberFormat: sfNumberFormat class.
  • sfNumberFormatInfo: sfNumberFormatInfo class

Log

  • sfAggregateLogger: sfAggregateLogger logs messages through several loggers.
  • sfCommandLogger: @package symfony
  • sfConsoleLogger: sfConsoleLogger logs messages to the console.
  • sfFileLogger: sfFileLogger logs messages in a file.
  • sfLogger: sfLogger is the abstract class for all logging classes.
  • sfLoggerInterface: sfLoggerInterface is the interface all symfony loggers must implement.
  • sfLoggerWrapper: sfLoggerWrapper wraps a class that implements sfLoggerInterface into a real sfLogger object.
  • sfNoLogger: sfNoLogger is a noop logger.
  • sfPropelLogger: A symfony logging adapter for Propel
  • sfStreamLogger: sfStreamLogger logs messages to a PHP stream.
  • sfVarLogger: sfVarLogger logs messages within its instance for later use.
  • sfWebDebugLogger: sfWebDebugLogger logs messages into the web debug toolbar.

Mailer

  • sfMailer: sfMailer is the main entry point for the mailer system.
  • sfMailerMessageLoggerPlugin: sfMailerMessageLoggerPlugin is a Swift plugin to log all sent messages.
  • Swift_DoctrineSpool: Swift_DoctrineSpool is a spool that uses Doctrine.
  • Swift_PropelSpool: Swift_PropelSpool is a spool that uses Propel.

Plugin

  • sfPearConfig: sfPearConfig.
  • sfPearDownloader: sfPearDownloader downloads files from the Internet.
  • sfPearEnvironment: sfPearEnvironment represents a PEAR environment.
  • sfPearFrontendPlugin: The PEAR Frontend object.
  • sfPearRest: sfPearRest interacts with a PEAR channel.
  • sfPearRest10: sfPearRest10 interacts with a PEAR channel that supports REST 1.0.
  • sfPearRest11: sfPearRest10 interacts with a PEAR channel that supports REST 1.1.
  • sfPearRestPlugin: sfPearRestPlugin interacts with a symfony plugin channel.
  • sfPluginDependencyException: sfPluginDependencyException.
  • sfPluginException: sfPluginException.
  • sfPluginManager: sfPluginManager allows you to manage plugins installation and uninstallation.
  • sfPluginRecursiveDependencyException: sfPluginRecursiveDependencyException.
  • sfPluginRestException: sfPluginRestException.
  • sfSymfonyPluginManager: sfSymfonyPluginManager allows you to manage symfony plugins installation and uninstallation.

Propel

  • sfMixer: sfMixer implements mixins and hooks.
  • sfPropelBaseTask: Base class for all symfony Propel tasks.
  • sfPropelBehavior: Manages behaviors for propel. Implements hooks for propel objects.
  • sfPropelBuildAllLoadTask: Generates Propel model, SQL, initializes database, and load data.
  • sfPropelBuildAllTask: Generates Propel model, SQL and initializes the database.
  • sfPropelBuildFiltersTask: Create filter form classes for the current model.
  • sfPropelBuildFormsTask: Create form classes for the current model.
  • sfPropelBuildModelTask: Create classes for the current model.
  • sfPropelBuildSchemaTask: Creates a schema.xml from an existing database.
  • sfPropelBuildSqlTask: Create SQL for the current model.
  • sfPropelData: This class is the Propel implementation of sfData. It interacts with the data source
  • sfPropelDatabaseSchema: Manages propel database schemas as YAML and XML.
  • sfPropelDataDumpTask: Dumps data to the fixtures directory.
  • sfPropelDataLoadTask: Loads YAML fixture data.
  • sfPropelGenerateAdminTask: Generates a Propel admin module.
  • sfPropelGenerateModuleForRouteTask: Generates a Propel module for a route definition.
  • sfPropelGenerateModuleTask: Generates a Propel module.
  • sfPropelGenerator: Propel generator.
  • sfPropelGraphvizTask: Generates a graphviz chart of current object model.
  • sfPropelInsertSqlTask: Inserts SQL for current model.
  • sfPropelManyToMany: Utilities for managing many to many relationships in propel.
  • sfPropelSchemaToXmlTask: Creates schema.yml from schema.xml.
  • sfPropelSchemaToYmlTask: Creates schema.yml from schema.xml.

Request

  • sfRequest: sfRequest provides methods for manipulating client request information such
  • sfWebRequest: sfWebRequest class.

Response

  • sfObjectRoute: sfObjectRoute represents a route that is bound to PHP object(s).
  • sfObjectRouteCollection: sfObjectRouteCollection represents a collection of routes bound to objects.
  • sfPatternRouting: sfPatternRouting class controls the generation and parsing of URLs.
  • sfPropelRoute: sfPropelRoute represents a route that is bound to a Propel class.
  • sfPropelRouteCollection: sfPropelRouteCollection represents a collection of routes bound to Propel objects.
  • sfRequestRoute: sfRequestRoute represents a route that is request aware.
  • sfRoute: sfRoute represents a route.
  • sfRouteCollection: sfRouteCollection represents a collection of routes.
  • sfRouting: sfRouting class controls the generation and parsing of URLs.

Storage

  • sfCacheSessionStorage: sfCacheSessionStorage manages session storage via a signed cookie and cache backend.
  • sfDatabaseSessionStorage: Base class for all sfStorage that uses a sfDatabase object as a storage.
  • sfMySQLiSessionStorage: Provides support for session storage using a MySQL brand database
  • sfMySQLSessionStorage: Provides support for session storage using a MySQL brand database.
  • sfNoStorage: sfNoStorage allows you to disable session support.
  • sfPDOSessionStorage: Provides support for session storage using a PDO database abstraction layer.
  • sfPostgreSQLSessionStorage: Provides support for session storage using a PostgreSQL brand database.
  • sfSessionStorage: sfSessionStorage allows you to store persistent symfony data in the user session.
  • sfSessionTestStorage: sfSessionTestStorage is a fake sfSessionStorage implementation to allow easy testing.
  • sfStorage: sfStorage allows you to customize the way symfony stores its persistent data.

Task

  • sfAppRoutesTask: Displays the current routes for an application.
  • sfBaseTask: Base class for all symfony tasks.
  • sfCacheClearTask: Clears the symfony cache.
  • sfCommandApplicationTask: Base class for tasks that depends on a sfCommandApplication object.
  • sfConfigureAuthorTask: Configures the main author of the project.
  • sfDeprecatedClassesValidation: Finds deprecated classes usage.
  • sfDeprecatedConfigurationFilesValidation: Finds deprecated configuration files usage.
  • sfDeprecatedHelpersValidation: Finds deprecated helpers usage.
  • sfDeprecatedMethodsValidation: Finds deprecated methods usage.
  • sfDeprecatedPluginsValidation: Finds deprecated plugins usage.
  • sfDeprecatedSettingsValidation: Finds deprecated settings usage.
  • sfDoctrineBuildTask: Generates code based on your schema.
  • sfDoctrineConfigureDatabaseTask: Configures the database connection.
  • sfGenerateAppTask: Generates a new application.
  • sfGenerateModuleTask: Generates a new module.
  • sfGenerateProjectTask: Generates a new project.
  • sfGenerateTaskTask: Creates a task skeleton
  • sfGeneratorBaseTask: Base class for all symfony generator tasks.
  • sfHelpTask: Displays help for a task.
  • sfI18nExtractTask: Extracts i18n strings from php files.
  • sfI18nFindTask: Finds non "i18n ready" strings in an application.
  • sfListTask: Lists tasks.
  • sfLogClearTask: Clears log files.
  • sfLogRotateTask: Rotates an application log files.
  • sfParameterHolderValidation: Finds usage of array notation with a parameter holder.
  • sfPluginAddChannelTask: Installs a plugin.
  • sfPluginBaseTask: Base class for all symfony plugin tasks.
  • sfPluginInstallTask: Installs a plugin.
  • sfPluginListTask: Lists installed plugins.
  • sfPluginPublishAssetsTask: Publishes Web Assets for Core and third party plugins
  • sfPluginUninstallTask: Uninstall a plugin.
  • sfPluginUpgradeTask: Upgrades a plugin.
  • sfProjectClearControllersTask: Clears all non production environment controllers.
  • sfProjectDeployTask: Deploys a project to another server.
  • sfProjectDisableTask: Disables an application in a given environment.
  • sfProjectEnableTask: Enables an application in a given environment.
  • sfProjectOptimizeTask: Optimizes a project for better performance.
  • sfProjectPermissionsTask: Fixes symfony directory permissions.
  • sfProjectSendEmailsTask: Send emails stored in a queue.
  • sfPropelBuildTask: Generates code based on your schema.
  • sfPropelConfigureDatabaseTask: Configures the database connection.
  • sfSymfonyTestTask: Launches the symfony test suite.
  • sfTask: Abstract class for all tasks.
  • sfValidateTask: Finds deprecated usage in a project.
  • sfValidation: Abstract class for validation classes.

User

  • sfBasicSecurityUser: sfBasicSecurityUser will handle any type of data as a credential.
  • sfSecurityUser: sfSecurityUser interface provides advanced security manipulation methods.

sfUser: sfUser wraps a client session and provides accessor methods for user

Util

  • sfBrowser: sfBrowser simulates a browser which can surf a symfony application.
  • sfBrowserBase: sfBrowserBase is the base class for sfBrowser.
  • sfCallable: sfCallable represents a PHP callable.
  • sfClassManipulator: sfClassManipulator manipulates class code.
  • sfContext: sfContext provides information about the current application context, such as
  • sfDomCssSelector: sfDomCssSelector allows to navigate a DOM with CSS selector.
  • sfFilesystem: sfFilesystem provides basic utility to manipulate the file system.
  • sfFinder: Allow to build rules to find files and directories.
  • sfGlobToRegex: Match globbing patterns against text.
  • sfInflector: @package symfony
  • sfNamespacedParameterHolder: sfNamespacedParameterHolder provides a class for managing parameters
  • sfNumberCompare: Numeric comparisons.
  • sfParameterHolder: sfParameterHolder provides a base class for managing parameters.
  • sfTimer: sfTimer class allows to time some PHP code.
  • sfTimerManager: sfTimerManager is a container for sfTimer objects.
  • sfToolkit: sfToolkit provides basic utility methods.

Validator

  • sfValidatedFile: sfValidatedFile represents a validated uploaded file.
  • sfValidatorAnd: sfValidatorAnd validates an input value if all validators passes.
  • sfValidatorBase: sfValidatorBase is the base class for all validators.
  • sfValidatorBoolean: sfValidatorBoolean validates a boolean. It also converts the input value to a valid boolean.
  • sfValidatorCallback: sfValidatorCallback validates an input value if the given callback does not throw a sfValidatorError.
  • sfValidatorChoice: sfValidatorChoice validates than the value is one of the expected values.
  • sfValidatorCSRFToken: sfValidatorCSRFToken checks that the token is valid.
  • sfValidatorDate: sfValidatorDate validates a date. It also converts the input value to a valid date.
  • sfValidatorDateRange: sfValidatorDateRange validates a range of date. It also converts the input values to valid dates.
  • sfValidatorDateTime: sfValidatorDateTime validates a date and a time. It also converts the input value to a valid date.
  • sfValidatorDecorator: sfValidatorDecorator decorates another validator.
  • sfValidatorEmail: sfValidatorEmail validates emails.
  • sfValidatorError: sfValidatorError represents a validation error.
  • sfValidatorErrorSchema: sfValidatorErrorSchema represents a validation schema error.
  • sfValidatorFile: sfValidatorFile validates an uploaded file.
  • sfValidatorFromDescription: sfValidatorFromDescription converts a string to a validator.
  • sfValidatorI18nChoiceCountry: sfValidatorI18nChoiceCountry validates than the value is a valid country.
  • sfValidatorI18nChoiceLanguage: sfValidatorI18nChoiceLanguage validates than the value is a valid language.
  • sfValidatorI18nChoiceTimezone: sfValidatorI18nChoiceLanguage validates than the value is a valid timezone.
  • sfValidatorInteger: sfValidatorInteger validates an integer. It also converts the input value to an integer.
  • sfValidatorNumber: sfValidatorNumber validates a number (integer or float). It also converts the input value to a float.
  • sfValidatorOr: sfValidatorOr validates an input value if at least one validator passes.
  • sfValidatorPass: sfValidatorPass is an identity validator. It simply returns the value unmodified.
  • sfValidatorPropelChoice: sfValidatorPropelChoice validates that the value is one of the rows of a table.
  • sfValidatorPropelUnique: sfValidatorPropelUnique validates that the uniqueness of a column.
  • sfValidatorRegex: sfValidatorRegex validates a value with a regular expression.
  • sfValidatorSchema: sfValidatorSchema represents an array of fields.
  • sfValidatorSchemaCompare: sfValidatorSchemaCompare compares several values from an array.
  • sfValidatorSchemaFilter: sfValidatorSchemaFilter executes non schema validator on a schema input value.
  • sfValidatorSchemaForEach: sfValidatorSchemaForEach wraps a validator multiple times in a single validator.
  • sfValidatorString: sfValidatorString validates a string. It also converts the input value to a string.
  • sfValidatorTime: sfValidatorTime validates a time. It also converts the input value to a valid time.
  • sfValidatorUrl: sfValidatorUrl validates Urls.

View

  • sfOutputEscaper: Abstract class that provides an interface for escaping of output.
  • sfOutputEscaperArrayDecorator: Output escaping decorator class for arrays.
  • sfOutputEscaperGetterDecorator: Abstract output escaping decorator class for "getter" objects.
  • sfOutputEscaperIteratorDecorator: Output escaping iterator decorator.
  • sfOutputEscaperObjectDecorator: Output escaping object decorator that intercepts all method calls and escapes
  • sfOutputEscaperSafe: Marks a variable as being safe for output.
  • sfPartialView: A View to render partials.
  • sfPHPView: A view that uses PHP as the templating engine.
  • sfView: A view represents the presentation layer of an action. Output can be
  • sfViewCacheManager: Cache class to cache the HTML results for actions and templates.
  • sfViewParameterHolder: sfViewParameterHolder stores all variables that will be available to the template.

Widget

  • sfWidget: sfWidget is the base class for all widgets.
  • sfWidgetForm: sfWidgetForm is the base class for all form widgets.
  • sfWidgetFormChoice: sfWidgetFormChoice represents a choice widget.
  • sfWidgetFormChoiceBase: sfWidgetFormChoiceBase is the base class for all choice/select widgets
  • sfWidgetFormDate: sfWidgetFormDate represents a date widget.
  • sfWidgetFormDateRange: sfWidgetFormDateRange represents a date range widget.
  • sfWidgetFormDateTime: sfWidgetFormDateTime represents a datetime widget.
  • sfWidgetFormFilterDate: sfWidgetFormFilterDate represents a date filter widget.
  • sfWidgetFormFilterInput: sfWidgetFormFilterInput represents an HTML input tag used for filtering text.
  • sfWidgetFormI18nChoiceCountry: sfWidgetFormI18nChoiceCountry represents a country choice widget.
  • sfWidgetFormI18nChoiceCurrency: sfWidgetFormI18nChoiceCurrency represents a currency choice widget.
  • sfWidgetFormI18nChoiceLanguage: sfWidgetFormI18nChoiceLanguage represents a language choice widget.
  • sfWidgetFormI18nChoiceTimezone: sfWidgetFormI18nChoiceTimezone represents a timezone choice widget.
  • sfWidgetFormI18nDate: sfWidgetFormI18nDate represents a date widget.
  • sfWidgetFormI18nDateTime: sfWidgetFormI18nDateTime represents a date and time widget.
  • sfWidgetFormI18nTime: sfWidgetFormI18nTime represents a time widget.
  • sfWidgetFormInput: sfWidgetFormInput represents an HTML input tag.
  • sfWidgetFormInputCheckbox: sfWidgetFormInputCheckbox represents an HTML checkbox tag.
  • sfWidgetFormInputFile: sfWidgetFormInputFile represents an upload HTML input tag.
  • sfWidgetFormInputFileEditable: sfWidgetFormInputFileEditable represents an upload HTML input tag with the possibility
  • sfWidgetFormInputHidden: sfWidgetFormInputHidden represents a hidden HTML input tag.
  • sfWidgetFormInputPassword: sfWidgetFormInputPassword represents a password HTML input tag.
  • sfWidgetFormInputText: sfWidgetFormInput represents an HTML text input tag.
  • sfWidgetFormPropelChoice: sfWidgetFormPropelChoice represents a choice widget for a model.
  • sfWidgetFormSchema: sfWidgetFormSchema represents an array of fields.
  • sfWidgetFormSchemaDecorator: sfWidgetFormSchemaDecorator wraps a form schema widget inside a given HTML snippet.
  • sfWidgetFormSchemaForEach: sfWidgetFormSchemaForEach duplicates a given widget multiple times in a widget schema.
  • sfWidgetFormSchemaFormatter: sfWidgetFormSchemaFormatter allows to format a form schema with HTML formats.
  • sfWidgetFormSchemaFormatterList:
  • sfWidgetFormSchemaFormatterTable:
  • sfWidgetFormSelect: sfWidgetFormSelect represents a select HTML tag.
  • sfWidgetFormSelectCheckbox: sfWidgetFormSelectCheckbox represents an array of checkboxes.
  • sfWidgetFormSelectMany: sfWidgetFormSelectMany represents a select HTML tag where you can select multiple values.
  • sfWidgetFormSelectRadio: sfWidgetFormSelectRadio represents radio HTML tags.
  • sfWidgetFormTextarea: sfWidgetFormTextarea represents a textarea HTML tag.
  • sfWidgetFormTime: sfWidgetFormTime represents a time widget.

Yaml

  • sfYaml: sfYaml offers convenience methods to load and dump YAML.
  • sfYamlDumper: sfYamlDumper dumps PHP variables to YAML strings.
  • sfYamlInline: sfYamlInline implements a YAML parser/dumper for the YAML inline syntax.
  • sfYamlParser: sfYamlParser parses YAML strings to convert them to PHP arrays.

Reference

top

  1. Symfony website, The home page for downloading and documentation.
  2. Symfony Jobeet, Day 1
  3. Symfony Jobeet, Day 3

See also

top

  • REST, Representational State Transfer, internal Website.
  • Webservices, Webservices SOAP, REST, WSDL etc.

Librosweb

The Website Librosweb has articles on Symfony Version 1.2, which they call the definitive guide to Symfony 1.2. Without arguing this site has comprehensive articles on Symfony called 'Symfony in Brief'. A few excerpts: