PHP

PHP tip: array_diff an array of objects

That’s tricky! Let’s assume we have two arrays like these:

Looking at these few lines I would expect that those two arrays are different but if we compare them with php array_diff function they’re the same:

This happens because array_diff compares array elements as string so it calls the __toString…

About inversion of control

Introduction Inversion of control seems to be a tricky topic among developers and every developer declins it in its own way. Searching on the web it seems that first usage of this term – that is not a pattern, rather a concept or a metodology – is attributable to Michael Mattson,…

Uso del Page Object Pattern con Behat: esempio pratico

Il Page Object è un pattern utilizzato nei functional test per astrarre l’interazione con gli elementi della UI. All’interno di un oggetto vengono incapsulate le interazioni e le funzionalità di una pagina web che vengono esposte tramite api, nascondendo la struttura degli elementi HTML all’esterno. Per approfondire il concetto rimando…

DevMarche: Scaling PHP apps

Martedi 9 Gennaio 2018 Madisoft sarà al Cowo42 di Osimo (AN) per parlare di scalabilità di applicazioni PHP. Partendo da sfide affrontate quotidianamente sul nostro software Nuvola, vedremo come siamo riusciti a scalare con successo l’applicazione per gestire milioni di visite e miliardi di dati. La serata è gratuita, compresa la…

Method order assertion in PHPSpec: Deferred Expectations

Disclaimer This post title can be misleading. Method order is just an implementation detail that should not be tested as PHPSpec philosophy is to test your public API, not the implementation as it would lead to fragile tests. Fundamentalists might say that following example should not be performed in PHPSpec but with…

Doctrine sharding

In the previous article we explored why sharding by tenant is a very good solution for us. In this article we dig into how to divide our Symfony app by shard. Doctrine We chose Doctrine as our ORM so let’s see what it offers to us. First of all you have to…

1 2