Category Archives: Symfony

Enable Symfony mailer with encryption

Configure your email in yourapp/config/factories.yml all: mailer: class: sfMailer param: transport: class: Swift_SmtpTransport param: host: mail.example.com port: 465 encryption: ssl username: yourname password: yourpassword And if you want email to work in the DEv environment: dev: mailer: param: delivery_strategy: realtime

Posted in Symfony | Tagged , | Leave a comment

Preserve PNG-32 Transparency using sfImageTransformPlugin

If you merge a PNG-32 (PNG format with an aplha channel) with another image, the transparent part of the original image will render with a solid black colour. The fix for this is quite simple. $bg = new sfImage(’main_image.jpg’); $bg = new sfImage(’blank_frame.png’); // has alpha channel $bg->transparency(’#000000′); // preserve alpha channel $bg->overlay($img, array(10,10)); The [...]

Posted in Symfony | 1 Comment

Symfony and TinyMCE rich text editor setup

Performed with Symfony v1.4.4 Install the sfFormExtraPlugin php symfony plugin:install sfFormExtraPlugin Download the required version of TinyMCE. Either the standalone version or the jQuery plugin version. Copy across the source files from your download into the web/js directory. Edit the view.yml to import your script. (jQuery plugin version shown below) javascripts: [jquery-1.4.2.min.js, tiny_mce/jquery.tinymce.js] Start using [...]

Posted in Symfony | Tagged , | 3 Comments

Symfony database configuration

Run this symfony task to configure you database. php symfony configure:database "mysql:host=localhost;dbname=dbname" root mYsEcret

Posted in Symfony | Tagged , | Leave a comment

Custom 404, 500 error pages for Symfony

404 errors: You can create your own default module to override the one provided with Symfony, or add an existing module and action to the config/settings.yml file. all: .settings: error_404_module: yourmodule error_404_action: youraction Supply a suitable template and clear the cache. 500 errors: Add a file error.html.php to the config/error directory in the root of [...]

Posted in Symfony | Tagged | Leave a comment

Change the web root folder in a Symfony project

Add to the setup method in the file config/ProjectConfiguration.class.php $this->setWebDir($this->getRootDir().DIRECTORY_SEPARATOR.’public_html’);

Posted in Symfony | Tagged , | 1 Comment

Enable logging in the Symfony production environment

By default, Symfony disables logging in the production environment. To enable logging edit the file apps/frontend/config/settings.yml prod: .settings: logging_enabled: on edit apps/frontend/config/factories.yml prod: logger: class: sfAggregateLogger param: level: debug Clear your cache and logging should now be enabled for the Symfony production environment. Tested on Symfony 1.4

Posted in Symfony | Tagged | 4 Comments

Git exclude file for Symfony Projects with Eclipse

This is my general Git exclude file for Symfony projects developed with Eclipse. .DS_Store /cache/* /log/* /.settings /.project /.buildpath

Also posted in Git | Tagged , , | Leave a comment

Symfony vhost configuration for Apache

An Apache virtual host configuration for a Symfony project. <VirtualHost *:80> DocumentRoot "/path/to/your/site/web" DirectoryIndex index.php ServerName www.exmaple.com <Directory "/path/to/your/site/web"> AllowOverride All Allow from All </Directory>   Alias /sf "/path/to/your/site/lib/vendor/symfony/data/web/sf" <Directory "/path/to/your/site/lib/vendor/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost>

Posted in Symfony | Leave a comment