Injecting repositories to service in Symfony2

It is generally a good idea to wrap business logic into services. Often, such services methods use doctrine’s repositories to operate on data storage. Injecting whole EntityManager service is a very popular approach, but it isn’t the most elegant way I could think of. EntityManager works only as a factory in that case and could lead to usage of other repositories, which might end up with too many responsibilities of given service.
The better way is to inject single repositories, using a factory-service mechanism, provided by the Dependency Injection Container.f

Read more

Android Meteoapp released as an Open Source

More than year ago I’ve played a little with Android Java SDK and I’ve created proof of concept of Meteoapp application. It fetches an meteograms from, cuts them into 6 parts and displays choosen parts for a given city. Meteoapp uses meteo library to interact with This library has been also open sourced.

Read more

Gender guessing based on name in PHP

Today I discovered neat PHP extension named Gender: It determines gender based on name and country. Probably below code will be useful on some point of your software development career 🙂

Read more

Thoughts after Symfony Live Berlin 2012

Lately I had a great opportunity to attend to Symfony Live conference in Berlin. That was our second chance to meet Symfony community after successful edition in London this year.

Read more

Is Symfony2 a MVC framework?

Is Symfony2 a MVC framework? This question in tricky and you can’t see answer at the first moment when you visit website. Even more – MVC pattern isn’t mentioned in elevator pitches in „What is Symfony” section. Most of PHP developers will tell you promptly, that this is Model View Controller implementation without a doubt.

The question is: where is Model layer in Symfony2? My answer is: there’s ain’t one and it’s good.

Read more

Export colored Behat scenarios to PDF

Everyone falls in love with Behat. It’s powerfull tool for testing business requirements in PHP. Behat scenarios, written in cross-platform Gherkin language, are readable for developers, easy to understand and verify for business people and executable by machine, which goes through an application to prove that it works as expected.

Behat scenarios are one of the best ways to describe system. UML Use Cases or tons of pages in SRS documents are fine, but hard to understand from the begining, and even harder to maintain in the future. Behat eases this process and also gives opportunity to automate requirements verification.

Read more

Let’s meet at PHPCon 2012Spotkajmy się na PHPCon 2012

During upcoming edition of PHPCon 2012 in Kielce I’ll give a talk „Symfony2 w chmurze” (Symfony2 in the cloud). I’ll describe advantages of cloud infrastructure purposed for web applications, some use cases of cloud deployments and things which developers need to keep in mind, to get Symfony2 application work properly in such environment.

More informations are available in PHPCon agenda:

See you there 🙂Podczas tegorocznej konferencji PHPCon 2012 w Kielcach (28-30 września) będę miał przyjemność poprowadzić prelekcję „Symfony2 w chmurze”. Będę mówił o zaletach korzystania z chmury jako infrastruktury serwerowej pod aplikacje webowe, przykładowych przypadkach użycia oraz zabiegach, o których należy pamiętać, aby aplikacja w napisana w frameworku Symfony2 działała poprawnie w takim środowisku.

Więcej informacji w agendzie PHPCon:

Do zobaczenia 🙂

Read more

Deploying Symfony2 applications with Ant

When you have plenty of Symfony2 applications and you need to deploy them from time to time, you are probably sick of thinking about every activity you need to do for every deploy. Often people use some build scripts, which are hard to maintain and tends to be unreadable. I wanted to automate it as much as it possible and I’ve choosen Ant, to help me out.

Actually Ant is choice, due to other fact – it can be easily used with Continous Integration server like Jenkins, while ssh scripts often generates some problems. With this aproach all you need to have Ant binary on server and build.xml config in root folder. You can have different targets defined in config and chain them using depend attribute. So in this case you can have target for building project on production server (usefull for continous delivery) and setup for Jenkins.

Read more

The most useful features of PHP 5.4

As you probably have noticed, PHP 5.4 is around the corner. As far, there’s Release Candidate 6 available and final release is a matter of weeks. Let’s have a look at new features, that will make PHPers live easier.

Read more

Always use most latest versions for benchmarks

In my previous post Modern framework comparison I presented performance tests, which compared Ruby On Rails, Django and Symfony2. After recieving a feedback in comments I decided to run this benchmark one more time on my own laptop (instead of on my hosting). The reason was simple: enviroment was outdated. I installed mod_python and configured it easily and struggled about one day with phussion passenger (AKA mod_rails) with ruby 1.9, but finally everything works. The results is compared in table below.

Read more