LATEST articles

Nelmio goes in-house…

By the end of this month, most of our client projects are ready to ship.

  • concat – our big-data project – thrives to explains the stock-market.
  • colibird – a state of the art web-of-things application – monitors energy in buildings.
  • kleio supports artists in their daily business.

So what comes next?

In-house contracting

In addition to client projects we regularly do in-house contracting. We integrate an existing team and assist with the technologies we specialise in. We help with the bootstrapping of a new project, add some manpower to a late project or simply join your team for a while to work and spread our knowledge.

After 3 years of Nelmio’s existence, we have realised that we really love that part of our job. It is what we do best. Where we can really focus on what we love. Ultimately, it is where our clients really get the most out of us. As a consequence, we have decided to focus on in-house contracting for a while.

Hire us

So here we are now, a bunch of highly qualified and motivated people ready to join your team:

  • Jordi is the author of Composer and knows every dirty secret of Symfony and PHP. He also has a good working knowledge of JavaScript and common sysadmin tasks.
  • Pierre has a passion of JavaScript. MV* frameworks (Backbone.js, Chaplin, …) are his daily business and he has developed a taste for CoffeeScript and node.js.

Do not hesitate to get in contact with us directly if your team needs some additional manpower:

January 21, 2014 by Pierre Spring in News // Tags: Comments Off on Nelmio goes in-house…

2.5 years Nelmio – celebrate with us on 05.09.2013

Dear all!

Some 2.5 years ago Jordi & Pierre started a story called Nelmio. Meanwhile a few chapters have been added – many pages have been written, read, torn out, rewritten and some of them marked with dog ears to be followed up on a later stage.

No matter if you already have been featured in this story or not. We are looking forward to welcoming you at Zentralstrasse 37 to have a drink and a bite together, listen to some live music, thank you for your collaboration or even start outlining a potential new chapter.

Save the date & see you soon!

For additional information, please use the following link:


August 19, 2013 by Florian Graf in News Comments Off on 2.5 years Nelmio – celebrate with us on 05.09.2013

Open-source projects update

I spent the last two days going over most of our OS projects, Symfony2 bundles and other libraries to fix some issues, merge pull requests and tag releases. Here is an update on all changes:

Alice – v1.5.0 – Expressive fixtures generator

  • Added extensibility features to allow the creation of a Symfony2 AliceBundle (hautelook/alice-bundle)
  • Added possibility to fetch objects by id with non-numeric ids
  • Added (local) flag for classes and objects to create value objects that should not be persisted
  • Added enums to create multiple objects (like fixture ranges but with names)
  • Added ProcessorInterface to be able to modify objects before they get persisted
  • Fixed cross-file references, everything is now persisted at once
  • Fixed self-referencing of objects

Also note that Baldur Rensch recently started working on a bundle to integrate Alice in Symfony2, you might want to check that out as well.

Monolog v1.6.0 – Logging for PHP

  • Added HipChatHandler to send logs to a HipChat chat room
  • Added ErrorLogHandler to send logs to PHP’s error_log function
  • Added NewRelicHandler to send logs to NewRelic’s service
  • Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler
  • Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel
  • Added stack traces output when normalizing exceptions (json output & co)
  • Added Monolog\Logger::API constant (currently 1)
  • Added support for ChromePHP’s v4.0 extension
  • Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel
  • Added support for sending messages to multiple users at once with the PushoverHandler
  • Fixed RavenHandler’s support for batch sending of messages (when behind a Buffer or FingersCrossedHandler)
  • Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now
  • Fixed issue in RotatingFileHandler when an open_basedir restriction is active
  • Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0
  • Fixed SyslogHandler issue when many were used concurrently with different facilities

MonologBundle v2.4.0 – Monolog integration in Sf2

  • Added support for the console, newrelic, hipchat, cube, amqp and error_log handlers
  • Added monolog.channels config option to define additional channels
  • Added excluded_404s property to the fingers_crossed handler to avoid logging 404s matching those regex patterns
  • Added ability to set multiple user ids in the pushover handler
  • Added support for an empty dsn in raven handler

Note that as of this version, the bundle’s release cycle is de-synchronized from the framework’s. It means you can just require "symfony/monolog-bundle": "~2.4" in your composer.json and Composer will automatically pick the latest version of the bundle that works with your current version of Symfony. The minimum version of Symfony2 for this workflow is 2.3.0.

NelmioSecurityBundle v1.2.0 – Additional security features for Sf2

  • Added Content-Security-Policy (CSP) 1.0 support
  • Added forced_ssl.whitelist property to define URLs that do not need to be force-redirected
  • Fixed session loss bug on 404 URLs in the CookieSessionHandler

NelmioJsLoggerBundle v1.2.0 – JS error logging in your Sf2 monolog logs

  • Added ability to give more context information by setting window.nelmio_js_logger_custom_context

NelmioCorsBundle v1.1.0 – Cross-Origin Request Headers support for Sf2

  • Added ability to set a wildcard on accept_headers

That’s it for today, but I would like to thank everyone that was involved in either sending pull requests or reporting bugs/feature requests to make all this happen!

July 30, 2013 by Jordi Boggiano in Development, News // Tags: , , , Comments Off on Open-source projects update

Firefox OS App Day

Last weekend I attended the first Firefox OS App Day held in Switzerland. Mozilla held the event to promote their new mobile operating system to developers and have people try and build apps.

Firefox OS is a new mobile OS by Mozilla that is entirely web based and therefore quite interesting for us web developers. They are developing many new JavaScript APIs to enable developers to use all the functionalities native apps typically get access to on other devices. And by submitting them for standardization to the W3C, there is a hope that one day all these APIs will be available on all platforms, making mobile web apps an even more attractive option.

In the morning a few talks were held to introduce the ecosystem and APIs. Then after a lunch break we had a few hours to hack an application together. My idea was to take a picture with the front-facing camera whenever you get a call. That picture would then be stored as the contact’s picture so that every time they call you you see the face you made the last time. It is a bit strange but sounded like a funny experiment.

Unfortunately the APIs to access the camera and handle incoming phone calls are for now still restricted to pre-installed applications (so-called Carrier apps). This means you can develop such an app and test it on your device if it is installed via the USB cable, but you could not deploy it on the Firefox Marketplace. It also means that right now those APIs are even less documented than the rest.

I did not find any docs for the camera API at all and had to look into the camera app’s sources to reverse engineer how to work the camera. That is a clear upside of fact that the entire OS is open source and written in JavaScript. Unfortunately I never managed to get an answer from the camera, when trying to take a picture it would just hang.

The telephony API on the other hand was documented a bit, but the docs did not include which permissions the app had to request to access the telephony objects, so I lost a lot of time with a crashing app before I figured it out looking at the OS sources again.

All in all the phones and OS still feel a bit “beta” when compared to more mature platforms. But it looks a lot better than what I saw six months ago in the pre-release state so I am quite hopeful that it will become an interesting platform in the near future.

My app in its somewhat broken state is available on github. I imagine the issues with the camera and all are fixable but I do not have a phone to test it with yet so I can not really work on the app anymore. The emulator allows you to develop some types of apps but it seems the camera and telephony APIs are not supported yet.

In any case Firefox OS is fun to play with for web developers and I would recommend you give it a shot, exciting times ahead!

June 6, 2013 by Jordi Boggiano in Development // Tags: , , Comments Off on Firefox OS App Day

Generating fixtures with Alice

A common problem in software development, is that you need data to work with. This is especially true with data-oriented websites. Working with an empty database leads to all sorts of unexpected problems cropping up once the site goes live and receives real world data. Performance issues, visual bugs due to missing fields, too long or too small texts, etc.

The best way to address this is to have fixtures, fake data you use while developing or for automated testing of the website. However writing these fixtures can be a cumbersome process which leads to people postponing it and sometimes outright skip this step.

It used to be that Doctrine1 could load fixtures from yaml files, and symfony1 also had facilities there, but none of this has been made available to Doctrine2 or Symfony2 yet, or at least not in a very usable form.

Instead of writing a plugin for either of those, I set out to write a generic library to easily create objects from yaml files. It can be used with any framework or ORM, and also integrates the great Faker library to generate fake/random data. The library takes a few opinionated turns, so it might not be for everyone. However I am sure it will save you a great deal of time should you decide to work with it.

The library is called Alice, after the common Alice and Bob placeholder names, and you can of course find it on GitHub, including extensive documentation.

Let me know what you think of it!

October 29, 2012 by Jordi Boggiano in Development, News // Tags: , , 18 Comments

A python solution to a secure backup of CouchDB via replication

This guest post was written by Reto. He works at Bluevalor, Nelmio’s very first client ever. Reto is a crack at analyzing economic data using MATLAB and Python. But he can not help himself and sometimes enjoys working on our infrastructure as well.

When we started our project with Nelmio, Pierre proposed to use CouchDB as a container for highly dimensional data items we receive from our third parties. We have been happy with CouchDB so far. One of the nice features of couch is its reliance on sequence IDs to assure very easy synchronisation between different CouchDB instances. It is even possible to use these sequence IDs to set up synchronisation between say SQL and CouchDB, since there is a nice API to query for changes in the CouchDB server.

A very convenient way to set up a backup of the data is to just configure a second CouchDB on another machine and replicate the data onto that machine. There is a feature called “continuous replication”. This seems to imply that you would have to set up the replication only once… However there is quite a big drawback as of CouchDB 1.2.: If the server is restarted, the replications will not be re-initiated. Even worse, sometimes replications just break down without any apparent reason.

Update: If you set up the replication via the _replicator database it fixes the restart issue.

In short: CouchDB’s “continuous replication” is not reliable enough as a backup system.

I’ve written a small Python script that you can run as a cronjob to check if a replication exists for a list of CouchDBs. As a little bonus, I added email notification in case something is wrong, so you can sleep well knowing your CouchDB backup is still working. With this script, it should be viable to backup your CouchDB databases via replication. I’ve attached the code after my little fanboy praise of Python.

I’ve studied finance and basically taught myself programming for scientific purposes. I’m trying really hard to write good code, but sometimes, I lack experience because I do not have a true programming background. If you’d like to point out things i could do better in terms of form, structure or function, please comment!

I’ve worked extensively with MATLAB so far. However, recently I stumbled over Python as a language for scientific computing and I’m absolutely loving it, so I would like to take the opportunity to praise on Python a little:

There are various reasons to use Python for scientific computing:

  1. high level language (good productivity, easy to learn for people like me)
  2. general purpose and object oriented (can interface with everything, bigger projects possible)
  3. beautiful, easy to read syntax
  4. ability to interface with low level languages if speed is first priority
  5. very rich libraries that support scientific computing needs
  6. open source (the MATLAB commercial license is 10-20k CHF depending on toolboxes)

With the open source packages numpy, scipy, ipython and pandas, Python pretty much trumps over every other scientific toolbox (R, MATLAB, Mathematica) while remaining super easy to use.

Especially pandas (an open source library that was developed at a hedge fund – true story!) improves data handling of time series ten-fold. I truly believe that if you need to do research with time series data, Python with pandas is the future.

So if you ever run into a problem where you need to do a lot of data cleaning and wrangling, look at pandas. There is a very good book called Python for Data Analysis written by Wes McKinney, the main developer of pandas (albeit only released as an “early release”).

Now to the code: Note that you will need the couchdb library to make this code work, so either install couchdb-python in your Python folder, or simply put it into the folder of the script. Note that I’ve only tested it with Python 2.7. You need to configure the “CONFIG” part of the script, and you should be all set.

import couchdb
import datetime
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

#source & target adresses
SOURCE = 'http://admin:pwd@host:5984'
TARGET = 'http://admin:pwd@host:5984'
#list of dbs (must have equal length)
SOURCE_DBS = ['db1', 'db2']
#email credentials
GMAIL_USER = "gmail_user"
GMAIL_PWD = "gmail_pwd"
TO = "your email"
# set to False if no email desired

class CheckReplicator(object):
    Checks if a replication for a list of dbs on the target exists between two
    CouchDB instances.

    Input a connection string for the source and the target of the
    replication and provide two lists with the names of the databases you want
    to have replicated. (source_dbs[0] will be replicated to target_dbs[0] etc)

    Note that this class prints to console, so if you want to log progress,
    print output to file in cronjob.

    Note that all the dbs need to be created. It is smart to initiate the
    first continuous sync via futon or http api!

    def __init__(self, source, target, source_dbs, target_dbs):
        db_equality = len(source_dbs) == len(target_dbs)
        assert db_equality, "source length must equal target length"

        self.source = couchdb.client.Server(source) = couchdb.client.Server(target)
        self.source_string = source
        self.target_string = target

        self.desired_reps = zip(source_dbs, target_dbs)
        self.active_reps = self._get_active_reps_on_target()

    def check(self):

        if self._check_if_all_desired_reps_exist():
            print str([:-7] + " ok"

    def _check_if_all_desired_reps_exist(self):
        res = True
        for d in self.desired_reps:
            if d not in self.active_reps:
                res = False
        return res

    def _fix_replications(self):
        for d in self.desired_reps:
            if d not in self.active_reps:
                source_str = self._build_source_string(d[0])
      , d[1], continuous=True)

        self.active_reps = self._get_active_reps_on_target()
        if not self._check_if_all_desired_reps_exist():
            raise EmailError("""
                             could not replicate all targets. Please
                             check if the couch instances are running
                             and all the dbs are created!
            print str([:-7] + " replicators created"

    def _build_source_string(self, db):
        string = self.source_string
        if string[-1] == '/':
            string = string + db
            string = string + '/' + db

        return string

    def _get_active_reps_on_target(self):

        tasks =

        #parse source and target of the task string
        #from the replication information
        active_reps = list()
        replications = [t['task'] for t in tasks if t['type'] == 'Replication']
        for r in replications:
            first_split = r.split('/ -> ')
            target = first_split[-1]
            second_split = first_split[-2].split('/')
            source = second_split[-1]
            active_reps.append((source, target))
        return active_reps

    def _check_connections(self):
            raise EmailError('could not connect to source', SEND_MAIL)

            raise EmailError('could not connect to target', SEND_MAIL)

class EmailError(Exception):

    def __init__(self, value, send_mail=False):
        self.value = value
        if send_mail:
            self._mail('Watchman Error', value)

    def __str__(self):
        return repr(self.value)

    def _mail(self, subject, text):
        msg = MIMEMultipart()

        msg['From'] = GMAIL_USER
        msg['To'] = TO
        msg['Subject'] = subject


        mailServer = smtplib.SMTP("", 587)
        mailServer.login(GMAIL_USER, GMAIL_PWD)
        mailServer.sendmail(GMAIL_USER, TO, msg.as_string())
        # Should be mailServer.quit(), but that crashes...

#run it!
if __name__ == '__main__':
        check_replicator = CheckReplicator(SOURCE, TARGET, SOURCE_DBS, TARGET_DBS)
        raise EmailError('program code failed', SEND_MAIL)
October 1, 2012 by Nelmio in Development // Tags: , 3 Comments

A Tour of Go

Last week we had to write what a small specialized HTTP client that connects to a server and issues GET requests to fetch data. Simple enough.

The only issue is that the data provider required us to use maximum one connection at any time, using HTTP pipelining to issue all the GET requests in the same connection and then block until they respond with new data. In practice this is not very complex, but PHP (our go-to hammer) is not really shining in this area.

All the HTTP abstractions around curl/http streams like Buzz or Guzzle do not seem to support pipelining (if I missed that, let me know), and doing it by hand is not particularly fun. The http extension does support that through some undocumented feature though, but I didn’t have that extension at hand, so I skipped that. In any case, PHP is not really the best tool for doing this sort of long running script, although it has gotten much better in recent years. So we looked for something else, and long story short, we decided to try Go. It is a new-ish language that is aiming to replace C/C++/Java for systems programming, mixing and matching features from everywhere while focusing on language terseness.

So what about Go?

Well it is interesting. I just opened an editor and within a few hours I had a first prototype running, a few more hours of polishing and tweaking later I had a finished product that has now been running for a week. It handled a few tens of thousands of entries, and especially did not crash once ;) The standard library is quite complete for what I wanted to do here, and there is already quite a large ecosystem of extra libs available for more specific tasks.

The documentation. It is not awful but it is a young language, and it could benefit from having more examples and cross-references. On the other hand I started coding without reading any of the basics, so I had to learn a few things the hard way. One big plus though is that the documentation links to the sources, so you can very easily check out what something does behind the scenes.

Static typing is a big change coming from PHP which abstracts away a lot of this. However thanks to their light approach to typing, you don’t feel it too much. Basically using := for assignment you can define a variable and have its type automatically inferred by the value you assign it. That gives you typing without the verbosity. Then of course you get compile-time errors based on all this which is great for debugging. Overall this saved me from doing a bunch of mistakes, and did not cause so much pain.

The recover function is also quite a nice fit for the use case at hand. It allows you to recover from any fatal error, and then keep running some code. Using this I made sure the program never dies, because if anything bad happens it will error out and restart doing its job instantly. It reacts much faster than monit or similar watchdog programs would typically do since it is triggered by the application failure.

Finally I want to quickly touch on goroutines. It allows you to do parallel processing very very easily. All you have to do is prefix a function call with the go keyword, and it turns into a background task of sorts. You can then use channels to communicate and block between multiple goroutines. It is a great model and should allow people to write parallelized programs without the pain usually associated.

To sum up, Go is quite fun. I would not use it to build a large web app though. I don’t think the tools are there yet and we have a great ecosystem in PHP for that. But for simple utils I would definitely recommend it to anyone that feels like trying something new.

June 22, 2012 by Jordi Boggiano in Development // Tags: , , 3 Comments

An Appeal to All Package Managers

I work on Composer – a new PHP dependency manager – and it is now working quite well for managing PHP packages. We have a decent amount (and growing fast) of packages on Packagist. All is well. Yet, most PHP projects are websites, and they need some frontend libraries, be it JavaScript or CSS – I will use jQuery as an example that everyone can grasp easily. In some frameworks, you have plugins that bundle a copy of jQuery. Some people have also used Composer to hack together jQuery packages so that they can download it, and then they have some scripts to copy or symlink the files in the proper location. That is all very flaky, you end up with multiple copies of jQuery and if you are lucky you even get various different versions.

I have been thinking about it for a few months, and it seems like nothing exists out there. Every language out there has its own package manager, but everyone seems to be stuck with the same problem of frontend code. Obviously jQuery is used by virtually everyone. They can’t support Composer, Bundler, npm, pip and god knows what. Building a package manager for JS/CSS could work, but the community is huge and scattered and getting broad adoption is going to be very difficult.

The plan

As far as I can see, and given the way Composer works, it would be fairly easy to build a central package repository – similar to Packagist – where people can submit package definitions for frontend libs. For instance I could go and add a twitter bootstrap package, define the URL where you can download it including some placeholder for the version. Then all we need is a list of version that’s maintained. We could start by doing that by hand, or we can just point it to the git repo and it reads tags. That’s how Packagist works – except that it reads the composer.json file in the git repo to get all the metadata that in this case would be entered manually.

If we do this, we then end up with a central repository of CSS and JS packages, and we can integrate it in Composer, so that Composer packages can depend on jQuery and it just works. That would be a good start, but the great thing would be to get everyone on board. And I don’t mean everyone writing PHP. I mean everyone. The Ruby folks, the Python ones, Java, .NET, you name it. You all have package managers. All we have to do is agree on the API of the central package repository and on what metadata is needed. Then you can just add support for it in your package manager of choice, and we all benefit from the manual work put in to list packages. If it works, I’m sure some of the frontend packages will then add the metadata directly in their git/svn/.. repos so that we save on manual work. This would be a huge thing for everyone.

There are of course a few more details to settle regarding security and trust as well as exact package metadata, but I wanted to gauge the interest first, and then discuss further. I opened a frontend-packaging google group for that purpose, so if you are interested please join in. All it takes is a few open minded people and we could start one of the largest cross-language collaboration project ever. Sounds like fun!

May 31, 2012 by Jordi Boggiano in Development // Tags: , , , , 8 Comments

Nelmio is hiring

You might have heard of us. If not, here is
who we are:

We are a little company in Zürich, Switzerland. Our clients trust us. Our projects are technically challenging and mostly use cutting edge technologies such as Backbone.js, Symfony2, Redis and CouchDB. By keeping the company small we have the ability to carefully choose the projects we want to work on. This also gives us time to attend many conferences, both as speakers and attendees. And starting this autumn, we will be working on our product as well!

Right now, we would like to grow by one person.

Problems we currently solve are:

  • Finding best practices for pure JS applications using Backbone.js.
  • Writing REST APIs in Symfony2
  • Optimizing CouchDB and MySQL to cope with large amounts of data.
  • Web of things – Connecting physical sensors with the web. This is particularly fun and hard.
  • DevOps – Automating deployments and server setup.

Things we do:

  • Code. Code. Code.
  • Learn from clients.
  • Teach and empower our clients.
  • Learn from each other. A lot!
  • Care about the little things that make a difference.
  • Fun things, because.

Things we don’t know:

  • Designing beautiful sites. But we know people who do this very well.
  • Ruby, Python, Dart, … We write mostly JS and PHP, and contribute a lot to make sure these stay in the game.
  • CMS. We only work on tailored solutions.

So, what do you think? Would you like to join our team?

  • We do work mostly in English even if there is always someone who throws in some French or German words.
  • You should have good communication skills, and be able to act autonomously. The ability to learn and think is more important than your existing knowledge.
  • Remote work could be an option. You would need to be in roughly the same time zone and can come work in Zürich for a few weeks in the beginning. That way we could get to know each other.

Send us your CV, GitHub account or anything you think is relevant to

May 30, 2012 by Pierre Spring in News // Tags: , , , 1 Comment

Nelmio is coming to a conference near you

Here is a quick update on conferences we will attend and speak at in the next couple months. If you are attending any, feel free to come and say hi!

Next week our entire team will be at jsDay and phpDay in Verona, Italy. If you haven’t got tickets yet, hurry up because it is about to be sold out.

Pierre will talk about Backbone.js, Igor has two talks about realtime apps with websockets and the Silex microframework and I myself will be talking about managing your dependencies with Composer.

In June there are two notable events. The first is SwissJeese. A local JavaScript-oriented conference co-organized by Pierre that will be in Bern. It is free and on a Saturday so there is really no excuse not to come if you have an interest in JavaScript. Register for free on eventbrite!

The second a week later is Symfony Live in Paris which we are always looking forward to.

If you get a chance to go to both phpDay and Symfony Live, you can follow Igor’s second talk about Silex, which will be more advanced given the audience is already more familiar with the Symfony Components. If you miss Verona you can catch up on my Composer talk in Paris as well. William will hold an introduction to the Propel2 ORM and even you have no interest in PHP I will present the Redis key-value store so you can come anyway ;)

We sure hope to see some old friends and make new ones there, so if you were hesitant to come, just register before it’s too late!

May 11, 2012 by Jordi Boggiano in News // Tags: , , , 1 Comment