#symfony

Recently I was working on a project where we had a page which loads tons of data from numerous sources. I decided after a while that we wanted to AJAX each section of data so that the page would load a bit quicker. After splitting up the requests and sending them asyncronously, there was little improvement. I thought at first it may be due to the fact we were pinging a single API for most of the data multiple times, that wasn’t it. Maybe it was a browser limit? Nope was still far below the 6 requests most allow. I setup xdebug and kcachegrind and to my surprise it was the session_start() that was taking the most time on the requests.

I looked around the web for a while trying to figure out what in the world was going on. It turns out that PHP’s default session_start will block future session_starts for the same session until the session is closed. This is because the default method uses a file on the filesystem which it locks until you close it. If you want more information on this and how to close it you can read a bit more here.

We switched over to database based sessions and it fixed it. In symfony 1.4 the default session storage uses the file system, however switching over to sfPDOSessionStorage is very easy and quick.

Posted In: PHP, Tips n' Tricks

Tags: , , ,

I recently took the Symfony2 plunge and started working on a little fun side project (more on that later).

Anyway, this particular project involves sending out daily text messages using the rather awesome Twilio API so I decided to use a Symfony2 task for this. The documentation on how to actually add your own task is a bit sparse so I figured I’d share.

The process is actually pretty straight forward:

  1. In your bundle create a directory named “Command” (without the quotes).
  2. Create a file that extends ContainerAwareCommand
  3. Create a protected function configure – “protected function configure()” to allow you to configure the name of your task and add any options or arguments you might need.
  4. Create a protected function execute – “protected function execute(InputInterface $input, OutputInterface $output)” to actually do whatever needs to be done.
  5. Thats it! Now you can run app/console and you’ll see your task.

Here is the code for mine:

Posted In: Symfony

Tags: , , ,

Symfony2 was released this past Thursday.  This marks a huge advancement in the framework with tons of new features, better programming patterns, and much better performance.  Symfony2 is now the most popular PHP project on GitHub and contributors are helping better it each day.

Since we are so excited for this release, we are going to take on one small free project for the person or company who submits the best idea and reason for their project.  We’ll be picking the free project within one week of today. Shoot us an email with your project and reason you’d like it done for free.

Congrats to the entire Symfony2 team and we look forward to helping out with it!

Posted In: Symfony

Tags: , ,

Last week we launched RentPrefs a new take on renting an apartment. RentPrefs flips the process around by allowing renters to post their preferences and then allowing agents to match them with listings that fit their criteria.

Anyway, yesterday Xconomy did an awesome write up about them so definitely check it out. We also got a nice mention at the end there!

Happy Friday!

Posted In: Launch

Tags: , , ,

Recently we’ve launched a new site for a client called Purpose Beverages: http://trackyourimpact.com . We’ve received great feedback from users so far. The site uses a wide range of technologies. It is built on symfony and uses the Apostrophe CMS to manage the main parts of the site. It integrates with a SMS provider to allow you text into it to find out more about your purchase.

Tēvolution is a new brand of tea on the market that does good with each purchase. Every time someone buys it they done a specific amount(for example 25 cents) to a specific charity. In order to find out how large of a donation and what charity your bottle goes to you can actually text the code found on the bottle to the website, or you can login in on your phone browser or regular browser and enter the code. You will find out how much and to whom you just donated money to!

Right now Tēvolution is just coming to the market so keep your eyes peeled for it! It’s a great product that does good!

Posted In: Launch

Tags: , , , ,