Niezalogowany [ logowanie ]
Subskrybuj kanał ATOM Kanał ATOM    Subskrybuj kanał ATOM dla tagu symfony Kanał ATOM (tag: symfony)

Autor wpisu: Piotr Pasich, dodany: 24.07.2015 05:00, tagi: php, symfony2, symfony

dark happy cartoon whale 1920 wallpaper

Part I – Setting up environment with Docker I have spent a lot of time watching presentations about automated deployment with Ansible, Capifony, Capistrano or making consistent environments with Vagrant or VirtualBox, but all of those presentations did not tought me how to build environment from scratch, to achieve complete continuous delivery system. And that’s […]

The post Continuous Deployment environment with Docker, AWS EB and Codeship appeared first on Piotr Pasich.

Autor wpisu: Piotr Pasich, dodany: 10.07.2015 09:30, tagi: php, symfony2, symfony


A couple of weeks ago I have discovered a new service – the It is a livestreaming platform where people code products, live. They connect people around the programming languages that they love. Streamers are a mix of professional engineers, students and hobby coders. So, I have decided to join the community and broadcast […]

The post Livecoding the SlackMessenger appeared first on Piotr Pasich.

Autor wpisu: Piotr Pasich, dodany: 09.07.2015 10:44, tagi: php, symfony2, symfony


Two days ago I have published a post at X-Team blog about achieving continuous deployment process. To do so, I choose the Docker for visualization, AWS Elastic Beanstalk as a delivery environment and Codeship as continuous integration system. The tutorial is created as a video screencasting starting from a basic Symfony application and and carried […]

The post From 0 to Continuous deployment in 90 minutes appeared first on Piotr Pasich.

Autor wpisu: Wojciech Sznapka, dodany: 24.10.2013 15:54, tagi: php, symfony

It’s extremely important to have same state of the System Under Test. In most of the cases it will be possible by having same contents in a database for every test. I’ve decribed how to achieve it in Fully isolated tests in Symfony2 blog post about two years ago (btw. it’s most popular post on […]

Autor wpisu: Wojciech Sznapka, dodany: 16.10.2013 14:06, tagi: symfony, oop, symfony2

It is generally a good idea to wrap business logic into services. Often, such services methods uses doctrine’s repositories to operate on data storage. Injecting whole EntityManager service is 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 […]

Autor wpisu: Athlan, dodany: 18.07.2013 01:41, tagi: php,, symfony


When you scale a PHP application you have to consider several aspects of runtime environment such us:

  • Bytecode caching (e.x. APC or Zend Optimizer Plus or eAccelerator), more;
  • Reading project files from RAM instead of HDD;
  • Caching and minify static content etc.
  • One additional aspect is storing sessions.

By default, PHP stores sessions in files. There are also several approaches to speed up saving sessions, such us memcached, mapping save_path folder as ramdisc, etc.

In scaling approaches there is important that many worker nodes (with deployed application) runs the same code, round-robin selected or load-ballanced, but have the same space to store sessions, because there is no guarantee in distributes architecture, that next user’s request will be handled by the same node. This implies, that session memory have to be shared between nodes, unfortunately storing these data in local RAM doesn’t meet this requirement.

Redis as PHP Session Handler

One of additional approach to storing sessions in fast-memory is Redis – key-value store. This could be configured as centralized or distributed database.

There is available a Redis session_handler for PHP. To use it:

  1. install Redis first as a service [more]
  2. copy/compile PHP extension [more information]
  3. register an extension in php.ini configuration file
  4. reconfigure session.save_handler in your php.ini configuration file, or set it directly on runtime by writing for e.x.:
ini_set('session.save_handler', 'redis');
ini_set('session.save_path', 'tcp://localhost:6379');
Redis Session Handler in Symfony 2

I am using Symfony 2 framework. Unfortunately, 4th step don’t affects the application. You have to register own SessionHandler in config.yml file:

        handler_id: session_handler_redis

This configuration uses new SessionHandler registered ad session_handler_redis Symfony Service (more).

We have to write own SessionHandler in Symfony. I have found the Redis SessionHandler proposed by Andrej Hudec on GitHub (original code here). I have decided to use and improve existing implementation.

Declare new SessionHandler class somewhere in your project:

namespace Fokus\Webapp\CommonBundle\SessionHandler;
use \Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
 * NativeRedisSessionStorage.
 * Driver for the redis session save hadlers provided by the redis PHP extension.
 * @see
 * @author Andrej Hudec <>
 * @author Piotr Pelczar <>
class NativeRedisSessionHandler extends NativeSessionHandler
     * Constructor.
     * @param string $savePath Path of redis server.
    public function __construct($savePath = "")
        if (!extension_loaded('redis')) {
            throw new \RuntimeException('PHP does not have "redis" session module registered');
        if ("" === $savePath) {
            $savePath = ini_get('session.save_path');
        if ("" === $savePath) {
            $savePath = "tcp://localhost:6379"; // guess path
        ini_set('session.save_handler', 'redis');
        ini_set('session.save_path', $savePath);

Now, add the entry that declares the class as a Symfony Service in services.yml file:

Czytaj dalej tutaj (rozwija treść wpisu)
Czytaj dalej na blogu autora...

Autor wpisu: Kamil Adryjanek, dodany: 23.05.2013 13:42, tagi: php, symfony, symfony2

W czwartek 6 czerwca 2013 o 16:15 na Uniwersytecie Marii CurieSkłodowskiej, już po raz drugi będę miał przyjemność poprowadzić wykład w ramach projektu: „Zdobądź wiedzę z Performance Media”. Temat mojegowykładu nie uległ zmianie, wprowadziłem jedynie drobne zmiany / poprawki w samej prezentacji: „Ewolucja projektowania aplikacji w PHP na bazie frameworka Symfony2″.

Dla przypomnienia poniżej znajduje się krótka agenda:

  • Ewolucja PHP. Krótka historia, ekosystem, co nowego w PHP?
  • Dlaczego Symfony2? Przegląd najważniejszych i najciekawszych możliwości frameworka;
  • Symfony2 w praktyce. Mini przegląd popularnych Bundli + CMS w 5 minut.

Wszystkich zainteresowanych tematem PHP / Symfony2 serdecznie zapraszam!

Więcej informacji na temat samych wykładów można znaleźć na stronie: Wykłady Performance Media

Wszystkie wpisy należą do ich twórców. nie ponosi odpowiedzialności za treść wpisów.