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

Artykuł mojego autorstwa w Software Developer Journal 05/2011

W najnowszym Software Developer Journal ukazał się mój artykuł pod tytułem „Test-Driven Development oraz Continous Integration w projektach PHP 5.3”. Zapraszam do lektury i dzielenia się spostrzeżeniami w komentarzach. http://sdjournal.pl/magazine/1683-po-co-nam-interfejsy-tworzenie-elastycznego-kodu

Read more

Dynamic LAMP setup for localhost development

If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app . In the minimum configuration effort, you need to pass those steps:

  1. checkout repository to disk
  2. create vhost configuration with some ServerName
  3. create entry in /etc/hosts which reflects server name used in vhost to 127.0.0.1

I’m pretty sure, that above path is used by many developers. We can ommit two lasts steps, limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.

Read more

Symfony2 showcase

Na firmowym blogu http://xlab.pl zamieściłem post odnośnie mojej ostatniej prezentacji na temat Symfony2 – zapraszam do lektury 🙂 Post jest dostępny pod tym linkiem.

Read more

How I passed Zend Certified Engineer exam for PHP 5.3

On thursday 25th of November 2010 I passed Zend Certified Engineer exam for PHP 5.3 thanks to certification program in company where I work – XSolve. It’s quite new exam, because of PHP 5.3, so I will describe my feelings and recomend you some helpful sources.

Read more

Power of the PHP streams – decompress gz archives on the fly from remote server

Probably most of us heard about streams in PHP. They are background of all files and network operations in PHP, even if we don’t see it. Everytime when you use file_get_contetnts or fopen you are actually using streams. But there are many stream wrappers I haven’t used, because they aren’t well known.

Read more

MongoDB – baza danych zorientowana dokumentowo. Czy ruch NoSQL ma sens?

Read more

Symfony sfWidgetFormSelect with disabled options

The sfWidgetFormSelect doesn’t provide ability to render disabled options. It’s rarely used feature of a HTML select element, but sometimes it could save your life 🙂 In fact, we can achieve this feature by creating our own widget, like one listed below, which inherits from sfWidgetFormSelect. This solution is inspired by problem posted on Symfony Experts.

Read more

Which convention is more common „static public function” or „public static function” (based on Symfony and Doctrine)

Few minutes ago Brent Shaffer asked on the Twitter

Which is more standard, „public static function” or „static public function”?

I was curious about it, so I’ve checked which convention is used in my favourite Symfony Project. Of course, I haven’t got enough time to check it manually, class by class, so I wrote simple bash script:

egrep "^[^\*/]*static.*function" /usr/share/php/symfony/ -rioh --include=*.php | sed 's/^\s*//g' | sort | uniq  -c | sort -r

The answer  for the Symfony 1.2 was:

685 public static function
181 static public function
27 static protected function
16 protected static function
16 private static function
11 static function
2 abstract public static function

I’ve done same thing for Doctrine ORM Project

egrep "^[^\*/]*static.*function" /usr/share/php/Doctrine/lib/ -rioh --include=*.php | sed 's/^\s*//g' | sort | uniq  -c | sort -r

and the result was:

78 public static function
6 static public function
6 static protected function

Now I can tell that „public static function” is more common, and by the way I use same convention in my classes 🙂

Read more

Using XML and XPath in PostgreSQL database

Everybody knows, that PostgreSQL is one of the best open-source RDBMS. The keyword here is „relational” database. For most purposes relational structure is okay, but sometimes we have to store highly complicated hierarchical data. Mapping such hierarchical structure to relational tables could be a real pain. A simple solution is to use a hierarchical markup language to present our data – XML. Luckily PostgreSQL provides a data type for storing XML documents. I was very optimistic about it, but it didn’t meet all my expectations.

Read more
older