Skip to main content

Posts

Showing posts with the label symfony-2.0

How to properly set up Varnish for Symfony2 sites?

I have a website (with ESI) that uses Symfony2 reverse proxy for caching. Average response is around 100ms. I tried to install Varnish on server to try it out. I followed guide from Symfony cookbook step by step, deleted everything in cache folder, but http_cache folder was still created when I tried it out. So I figured I could try to comment out $kernel = new AppCache($kernel); from app.php . That worked pretty well. http_cache wasn't created anymore and by varnishstat, Varnish seemed to be working:

Deploying / Continuous integration of a Symfony 2 application with Jenkins/Hudson

I've developed an application which uses the Symfony 2 framework. The application code resides in a Bundle, and on my local machine I just downloaded the Symfony2 Standard Distribution and added the Bundle to the src folder as the tutorials describe, before editing the config / routing files appropriately. That's served me well from a development perspective.

Symfony 2 or Lithium?

The answer may be based on 4 aspects: 1.- simplicity: we all hate write tons of code for simple tasks like in java, this is the reason why we use php, importing design patterns from java/university world is good, but usually independent developers like me need dev speed more than enterprise employees. 2.- backend: how easy will be building a backend in symfony 2 vs lithium?. not always we build a facebook like project and we need our preferred framework to get the job done on little projects too. 3.- community and docs 4.- performance: scale good with the minimum Source: Tips4all

creating my own library in symfony 2

I'm trying to create my own library in a Symfony2 project but I'm having a hard time doing so... Basically I want to reuse an FTP browser class I made for another project. I copied the class into /vendor/mylib and tried to autoload it like that $loader->registerPrefixes(array( 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib', 'Twig_' => __DIR__.'/../vendor/twig/lib', 'Mylib_' => __DIR__.'/../vendor/mylib' )); I then tried to instantiate a Mylib_Test object inside my bundle's controller and I got this error : Fatal error: Class 'Test\FrontBundle\Controller\Mylib_Test' not found in /Applications/MAMP/htdocs/sf2_project/src/Test/FrontBundle/Controller/WelcomeController.php on line 26 Anyone has an idea on how to do this ?

Strategy pattern in Symfony2

I'm trying to build simple service for rendering various types of pages. Basic concept is having something like: $somePageType = new PageType(...); $this->get('page.service')->render($somePagetype); ...which would be designed as Strategy pattern . Page types would implement interface with render method and page.service would call it. The problem is I'd like to use Doctrine in page type classes. What are my options here? I'd like to avoid creating service for each of these classes. Is that even possible? Is it possible to make them container aware without being services? Possibly, in the future, some page type might need something more than only Doctrine, so I need to keep in mind also that.