Php

Deploying PHP applications with Ansistrano

Deploying PHP applications with Ansistrano

For a very long time, Capistrano was, without any doubt, the de-facto tool to deploy your dynamic languages applications. Now there is a better one, Ansible based, called Ansistrano. Ansistrano was initially created by Carlos Buenosvinos and is a set of 2 Ansible roles: deploy and rollback. It has almost 200 stars on Github and some large companies are already using it. In this video you can see how to deploy a small Silex application and you can also see how to rollback and add a small hook reloading the opcache in your production servers.

Symfony2 versus Go: Round 1 - Hello world (static pages)

In my new job at Hailo we are introducing Go as the main language in the new architecture and because of that I have started playing with it. Besides that, there has been a lot of comments and opinions in both the Symfony2 and the PHP community regarding the TechEmpower framework benchmarks where Symfony2 appears at the bottom of the list for most of the tests. Needless to say, PHP is and will always be slower than a compiled new-generation language.
APC Settings: stat and shm_size

APC Settings: stat and shm_size

Most of you already know that APC is really important to boost PHP performance. It will probably be replaced in the next months / years by Zend Optimizer+ but meanwhile it is important to know how to properly tweak this amazing PHP extension. If we have a look at http://php.net/manual/en/apc.configuration.php we will see in the first couple of lines that both stat and shm_size are the most important directives but most people seem to not know about them, and this is why I am writing this post.
APC vs Zend Optimizer+ Benchmarks with Symfony2

APC vs Zend Optimizer+ Benchmarks with Symfony2

If you are following some of the biggest names in the PHP scene you may have seen that Zend Optimizer+ is now open-source on Github at https://github.com/zend-dev/ZendOptimizerPlus and it seems that will be included in PHP 5.5 distribution. This is awesome news as we will finally get a PHP Accelerator bundled with the main language distribution and there should not be (let’s hope) weird issues like the ones happening in early versions of PHP 5.

Testing Symfony2 Commands - Mocking the DI Container with Mockery

Some months ago I had the pleasure to contribute to phpcassa library, maintained by Tyler Hobbs, adding support for Composer and Travis, and fixing some issues with PHP5.4 and some E_STRICT warnings. And, as there is no Symfony2 bundle for Cassandra yet, I have decided to create one myself. The bundle is at early stages but I have already developed some basic Administration commands, mainly to create a Keyspace, a ColumnFamily, etc… and I have decided to share here how I have unit-tested those commands.

How to log messages to different files with Monolog in Symfony2.0

If you are logging lots of activity in your Symfony2.0 application you might have seen that it is not that obvious to split them into different files. This has been solved in Symfony2.1, thanks to MonologBundle channels (Cookbook here) but if you are in Symfony2.0 and need to handle different log files this is the way to do so: You’ll have to define a new Logger service and a Handler service for that logger.

Composer.json and Travis-ci for our Symfony2 Bundles

Travis-CI and Packagist / composer.json are the new toys in the PHP community and specially amongst the Symfony2 developers crew. I like Travis-CI because you can easily setup Continous Integration to some degree without having to setup a full working Jenkins (or whatever suite) environment and code can be tested with different PHP versions. This can be really useful to ensure that our code is ready for the incoming PHP5.

How to use Symfony2 validator component without forms (Entities and data arrays)

There seems to be a lot of confusion when using Symfony2 validation outside CRUD and Forms but the thing is that these component can be used in many ways to validate stuff all around the application. I will show 2 examples of how we use validation component at Ulabox for 2 quite common issues in e-commerce: Credit Card Validation using Entity Classes (without being linked to a table) and Annotations

Nacimiento del blog

Tras asistir el pasado fin de semana a la PHP Barcelona Conference 2010 me he decidido a abrir esta página y intentar aportar alguna cosa más al mundillo de la programación web; en especial PHP, MySQL y JavaScript, que son las tecnologías con las que trabajo. También intentaré poner alguna cosa de cómics, música y videojuegos que me parezca interesante. Espero actualizar regularmente y que haya artículos de interés. De momento tengo pensado ir subiendo parte de las transparencias que usaba en mi etapa de profesor de Programación en PHP y MySQL así como de preparación a la certificación Zend.