23 April 2017 — Comments
In a project I'm working on, we recently needed to add some kind of encryption system that allowed us to store sensitive information in a secure manner, but being able to access to it at runtime in order to pass it to third party services.
Securely storing your own app passwords is easy. You just hash it, and the password can be verified without having to decrypt it, but if you need to "decrypt" it, the solution is not that easy.
We started by building our own solution based on zend/crypt, which is an excellent solution and works like a charm, but you still need to store the master key somehow, and that's the big problem.
21 April 2017 — Comments
Recently I have been testing one service and its clustering capabilities, in order to see if it fits in a project I'm working on.
I decided the easiest way to do this was by creating a couple docker containers and setting up a cluster between them. It should be an easy task in theory.
My first approach was using a docker-compose file and linking the containers between themselves:
version: '3' services: test_1: container_name: test_1 image: some:image links: - test_2 - test_3 test_2: container_name: test_2 image: some:image links: - test_1 - test_3 test_3: container_name: test_3 image: some:image links: - test_1 - test_2
27 March 2017 — Comments
The day Zend Expressive 2 was released I was super excited. I have been using it a lot for both professional and personal projects, so I'm quite used to it.
Since I've been using it in many projects, being able to update all of them to version 2 was a challenge, but I can say, I have succeed :-)
When I migrated my website to expressive, I had to create a custom router for backward compatibility reasons, because none of the provided implementations supports optional params at the beginning of the path, and I was using them.
06 March 2017 — Comments
It has been a long time since I first realized that handling file uploads in non-POST requests (like PUT) wasn't an easy task.
One could assume the
$_FILES array should be populated regardless the HTTP verb, but actually, PHP doesn't do it on its own.
After a long time wanting to find a solution to this problem, I've finally dedicated the time to get something functional, that allows file uploads to be transparently handled regardless the HTTP verb (it works the same way in POST, PUT and PATCH requests).
Since nowadays I try to work with psr-7/middleware based applications, I have created a Zend Expressive app that registers a middleware capable of parsing a
multipart/form-data request body, populating the request's uploaded files array and parsed body array.
01 February 2017 — Comments
Docker is, without any doubt, the trending tool these days. Everybody wants to use it, because it is very useful, allowing to easily generate development environments for any kind of application.
A couple months ago I started working with docker myself (it has taken me a while, I know), and now I can't imagine working without it.
I started using it at work, but now I'm migrating all of my OSS projects too.
Regardless docker is very cool, there is a problem when you start using it.
I had my development environment perfectly configured, and all my tools properly integrated. I was able, among other things, to run any project tests from within PhpStorm, just by right-clicking any test class, test method or phpunit.xml file, and selecting the "Run" option.