Symfony2 Framework
9.9K views | +0 today
Follow
Symfony2 Framework
Everything about Symfony2
Curated by xinjie zhang
Your new post is loading...
Your new post is loading...
Rescooped by xinjie zhang from PHPEdit PHP IDE
Scoop.it!

A Look at Silex: A Symfony2-based PHP Microframework

 Microframeworks are a trending topic in PHP land right now, and a usage good example is now online for the Silex microframework along with some great advice on when to use microframeworks in general.

Via PHPEdit
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Symfony2: Implementing ACL rules in your Data Fixtures

Symfony2: Implementing ACL rules in your Data Fixtures | Symfony2 Framework | Scoop.it
Symfony2: Implementing ACL rules in your Data Fixtures. Doctrine's DataFixtures are a great way to add test data to your application. It's fairly easy to get this going: Create a fixureLoader that extends ...
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Custom MongoDB Security Provider in Symfony2

At work, we’ve decided to upgrade our entire workflow. One of the main decisions we’ve had to make, was which PHP framework we wanted to start using. I have quite some experience with Zend Framework, so I was kinda biased towards that framework. However, the team didn’t want to create a new codebase on ZF1. Since waiting till ZF2 is released was not an option, we decided to give Symfony2 a try.

To each build up some experience with SF2, each team member was tasked to create a blog system with SF2. I decided to use MongoDB as my preferred method of data persistence, since the rest of the team also showed quite some interest in using this technology. Following the documentation on the Symfony2 website, I quickly set up my BlogBundle, with an administration interface and everything. The next step was to secure the backoffice with user credentials coming from a MongoDB collection. This is when a whole world of hurt opened up: almost no information on the intertubes on how to do this. I figured out I would need a custom UserInterface and UserProviderInterface. People kept referring to theFOSUserBundle. The Friends of Symfony are a cool bunch, but I wanted to write my own code, as part of the learning process. A couple of hours and an almost-headache later, I had figured it out. Since there will probably be other people struggling with this, here’s how I did it.

more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Varnish+ESI实现静态页面的局部缓存

页面静态化是搭建高性能网站必用的招式之一,页面静态化可以有效提升系统响应速度,同时也有利于搜索引擎优化。但在页面静态化后,静态页面之间包含(例如所有的静态页面包含页头、页脚)以及静态页面中的局部信息的动态更新又成为新的问题。    静态页面之间的包含一般有如下一些方案:   1、Client Side Includes(CSI):通过frame、iframe、javascript、javacript+ajax等方式将另外一个页面的内容动态包含进来。像现在流行的jquery...
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Symfony2 Frontend Performance Optimiziation

I am going to talk about:
  1. Frontend performance analysis and basic tips
  2. Assetic to get serious about css and js optimization
  3. Caching
  4. Varnish and ESI
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Symfony2 and twig render performance issues

One of my favorite features in symfony is the render tag, embedding controller calls. The profiler adds a lot overhead to every controller calls though, not only speed but uses a lot of memory. You have a few options to speed it up.

The profiler writes every data into a sqlite database by default. IIRC sqlite doesn't allow parallel inserts, so every request have to wait for their turn to access the db to flush data collectors. You can use your development db (mysql or whatever you use) to persist profiler data. A year ago I gained a lot with this in terms of speed.

You can also disable the profiler for sub requests, or only use the profiler when an exception happens. See the framework config reference for the full details.

more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

An Introduction to Scaling Symfony

A brief introduction to cache strategy and other performance-enhancing techniques when using the symfony full-stack framework.

...

more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Symfony2: pass parameter to all views - Stack Overflow

The simplest solution is to embed controllers from your templates/layout. But beware that subrequests are costly and can affect performance significantly. If at some point you'll notice that the dev version of your app is slow as hell, then know that the reason is probably several subrequests on each request.

The next solution is Twig extensions. In most cases you'll want functions. You could call it like:

{{ user_info(user) }}
I started with embedding controllers first, but my dev version reached the point when most pages on my site were timing out in 30 seconds. I didn't know the reason first, but as soon as I found it out, I replaced all subrequsts with Twig extensions. Since then the performance is back to normal.

more...
No comment yet.
Rescooped by xinjie zhang from #CodeReview
Scoop.it!

Symfony2, Redis, Varnish, HA Proxy... (Keynote at ConFoo 2012) | Hacker News

RT @HNTweets: YouPorn: Symfony2, Redis, Varnish, HA Proxy...

Via Ex FromTheLeft
more...
No comment yet.
Rescooped by xinjie zhang from #CodeReview
Scoop.it!

Jobeet Tutorial with Symfony2

Jobeet Tutorial with Symfony2 | Symfony2 Framework | Scoop.it
Jobeet is a great tutorial wrote by the Symfony team to help you learn how to use the framework by building a fully functional job board website.

Via Ex FromTheLeft
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Storing Sessions in MongoDB with Symfony2

When it comes to sessions in PHP, you generally have two options. Either you work with the built-in sessions by using session_set_save_handler, or you roll your own. Symfony2 provides a lot of help in both scenarios, you have the NativeSessionStorage, which in turn have different subclasses that use different session save handlers, or you could implement SessionStorageInterface, and do your own thing.

more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Edge Side Includes with Varnish in 10 minutes

Edge Side Includes with Varnish in 10 minutes | Symfony2 Framework | Scoop.it
Varnish is a tool built to be an intermediate server in the HTTP chain, not an origin one like Apache or IIS.
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Setup Symfony2, ESI & Varnish


Install Varnish, (e)Nginx, MySQL, APC and PHP using the following guides.

  1. Launch Ubuntu on Linode
  2. Install and Configure Nginx
  3. Install and Configure PHP-FPM
  4. Install and Configure MySQL
  5. Install and Configure APC
  6. Install and Configure Varnish


more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

High Performance Websites with Symfony2

What is Performance?
  • Single vs. double quotes?
  • Throughput?
  • Server response time?
  • Render response time?
more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Twig: render vs include

Each render call spawns a new request, with the performance degradation issue that you are describing. I don't think there is much you can do about that but using esi caching, so that single fragments coming from render calls can be cached. Otherwise you could try to revise your logic to reduce the usage of render calls.

more...
No comment yet.
Scooped by xinjie zhang
Scoop.it!

Symfony2 and Twig Pagination « DBL-A Dev Blog

Symfony2 and Twig Pagination. July 2nd 2012. by theodor.diaconu. Pagination is an essential tool for web developing. Here's a nice and standardized way to do this: You need the following variables: currentFilters: an associative array that ...
more...