Blog posts tagged with php

Fixing failing Behat scenarios in large suites

In projects I currently work on I'm taking the BDD approach really seriously. In one of my Symfony2 projects I ended up with quite a lot of Behat features and scenarios which one day started failing on the integration server. The problem was in MySQL returning "too many connections" response.

Managing object creation in PHP with the Symfony2 Dependency Injection component

Symfony's DependencyInjection component is a PHP implementation of a Service Container, or as others like to call it, a Dependency Injection Container (DIC). The component also provides useful tools for handling service definitions, like XML loaders or dumpers.

Symfony 2.0 released!

Today, 28th of July 2011, Symfony 2 was announced stable. We've been waiting long but it was worth it!

Finding files and directories in PHP with Symfony2 Finder component

Symfony Finder component makes the task of finding files and directories less tedious. It supports filtering by name, pattern, size, date of modification and few other criteria. As a result we get objects of class SplFileInfo. It offers convenient way of retrieving file and directory details.

Creating parametrized command line scripts in PHP with Symfony2 Console component

Symfony Console component enables us to create commands in PHP. It does all the nasty work of handling input and output.

Autoloading classes in an any PHP project with Symfony2 ClassLoader component

Symfony ClassLoader component is a PSR-0 standard compliant PHP class autoloader. It's not only able to load namespaced code but also supports old-school PEAR standards (also used by Zend Framework). It's a perfect class loading tool for most of PHP projects.

Setting up a PHP development environment with Nginx on Ubuntu 11.04

I already described how to prepare a PHP development environment with Nginx on Ubuntu 10.04. Ubuntu 11.04 (Natty Narwhal) simplifies the procedure a lot since php-fpm is available in the PHP 5.3 core. As I also managed to improve my Nginx configuration for PHP I decided to write on the subject again.

Nginx configuration for Symfony projects

Recent release of Nginx 1.0.0 triggered me to refresh my knowledge about its configuration options. There were quite some additions since I looked in the docs for the last time. New variables and directives let me to simplify my configuration for Symfony projects (both 1.x and 2).

Multistage deployment of Symfony applications with capifony

Capifony is a collection of Capistrano deployment recipes for both symfony and Symfony2 applications. Multistage is an extension for Capistrano which enables deployments to multiple servers with varying configurations or deployment procedures.

Things I like about the new Symfony2 Form Component

Forms Refactoring, the last big change and recently most awaited pull request for Symfony2, was finally finished last Sunday. The work is not fully done but it's ready for merge. Request is still waiting for approval and as soon as it's accepted (or rejected) we can expect a beta release.

Learning Symfony2 by Unit Testing (Contribute to Learn)

During the Hacking Day on the Symfony Live conference I decided to give it a try and write some unit tests for Symfony2. I'm a big fan of TDD for quite some time already and I recently became really interested in BDD. For sure I'm not new to unit testing. Still, I didn't expect that writing tests for an existing piece of software can be so much fun.What I also discovered is that writing unit tests for Symfony is a great way to learn its internals.

Symfony Live 2011

I'm writing this post on a way back from the second international Symfony Live conference. Nearly 500 developers arrived to Paris from all over the world to participate in this great event.

Doctrine2 and Symfony2

I continue exploring the Symfony2 framework. It's flexible enough to be used with any modern PHP ORM. However, as with everything in Symfony2, there are sensible defaults provided. In case of an ORM it's Doctrine2 bundle.

Setting up a bleeding edge Symfony2 project

Symfony2 is not ready yet. Since the release is planned for March this year and I just can't wait any longer I started to play with it more seriously.I also want to know all those nitty-gritty details. Therefore I didn't go for sandbox and decided to generate a fresh project.

Heard in the Community (2010.08.15)

Munchkin is a series of tutorials showing how to build a PHP project with the best programming practices in mind. As Author says: "If you consider the average PHP world and average RPG, where the players are coders, then doing agile and TDD would definitely make you a power player who gets all the loot.". Not in all cases I would use the same tools but it's not about copying the author. Tools doesn't matter as much as the proper approach he tries to teach us.

Heard in the Community (2010.08.08)

Jonathan Wage wrote on his blog about Doctrine Annotations Library. It's used in Doctrine2 ORM for mapping information specified in doc-blocks. I'm really excited about it, especially because it is an independent library. It makes it a perfect tool for meta-programming. I can't wait to put my hands on it!

Heard in the Community (2010.08.01)

Symfony2 development moves forward quickly. Last week the API documentation was generated and put online by Fabien Potencier. Also, the translation process is now described so translators can start contributing.

Symfony meets APC (Alternative PHP Cache)

Up to last week I was exclusively an XCache user if we talk about PHP accelerators. Recently I needed to use APC with a symfony application. As symfony offers nice APC integration it went quite smooth.

Heard in the Community (2010.07.25)

"Heard in the Community" series aims to wrap up news from the PHP, symfony and other communities I find interesting and follow.

PostgreSQL installation in Ubuntu 10.04

PostgreSQL is a powerful and reliable object-relational database system. It's a great alternative for MySQL. It is as easy to set up, performs better and offers far more features.

MySQL installation in Ubuntu 10.04

MySQL is one of the most popular relational database systems which is widely used with PHP applications. It's relatively easy to set up and use. Here's a quick guide of how to install and configure MySQL in the newest release of Ubuntu.

Reply to PHP 5.3 and the Future

Mark Evans wrote on his blog interesting post about PHP 5.3 and the Future. I guess the main concern here is similar we used to have with PHP4 to PHP5 migration (GoPHP5 campaign). Mark raised three questions to the community which I'd like to reply to.

Jumping to a class, function and variable definitions in vim with exuberant ctags

Exuberant ctags make it possible to jump to the definition of a class, method, variable and any other language object in vim. Tool is able to generate an index file (a.k.a tag file) for one of 41 supported programming languages. Index can be used by editors like vim to quickly find related keyword.

Setting up a PHP development environment with nginx on Ubuntu 10.04

Nginx is a lightweight http, proxy and load balancing server. It's a serious alternative for a widely used apache. Most important advantages of nginx on a production environments are speed and small amount of memory it uses. In a development environment I really like the simple and flexible configuration. Here's a guide how to quickly prepare PHP development environment with nginx on Ubuntu 10.04 (Lucid Lynx).

Symphony CMS on nginx

I decided to give a Symphony CMS a try because of its XSLT templating system and structured approach in creating websites. As most of PHP applications it's running on apache out of the box. Since I preffer using nginx I've encountered small problems with the configuration.

Using SimpleXML with sfWebBrowser to parse html documents

sfWebBrowser is a class that emulates browser calls. It gives us nice object oriented interface to navigate through document structure in a programmed way. It can return response as SimpleXML which enables us to use xpath queries on the document being parsed. Unfortunately html pages are hardly ever XML valid documents. That's why in most cases sfWebBrowser rather throws and exception than returns something. Here is how we can write a workaround for it.