Google Tag Manager Server Side Service

I have used GTM for a few years in many projects because it provides the ability to manage all website tags without updating production. This is very helpful if you have middle or big-sized projects and can’t update the code in production often.

This summer, Google created a release of GTM Server Side Containers but having this type of container is not free. Google bill for one test container near 40$ per month, and if you need a production-ready version, prices start from 100$ per month.

This is a little bit expensive for not commercial or small projects. That’s why I started my own project that handles GTM Server Side deploying much cheaper and easier.

GTM SS Service

GTM Server Side allows you to hide business logic in the server code, speed up website loading, and improve user data protection by restricting access to them by third-party scripts. My service has a free plan and doesn’t require a credit card or any specific knowledge of its works instead of Google Cloud deploying. That’s why all clients like it.

Also, as I am a back-end developer, it is much easier to develop tags and provide solutions for the client in a server container instead of the web container. I already developed a few tags for the server-side container, and of course, all of them can be found on GitHub. If you have any suggestions of what else I can add or maybe what your project needs for server side analytic just write to me and I will try to help you with this.

I spend a lot of time researching and developing it, so I hope that it will have a great future because it is widespread and already has clients who use it. Wish me good luck with this project)

Setup Github desktop and Tower to work with gpg

GPG sign
Few days ago I decided to use gpg sign for my commits. I follow by instruction on github and all start working like expected, but only if I use official console client.

When I use Github Desktop client or Tower I get error that there are problem with making commit.
To fix that I install gpg tools and in .gitconfig add:

[commit]
gpgsign = true
[gpg]
program = /usr/local/bin/gpg_wrap

The gpg_wrap file contain this code:

#!/bin/sh
/usr/local/bin/gpg --batch $*

After making this small hack all GUI git clients work correct for me.

Filtering data in Symfony

Data filter

All lovers of Symfony knows that it does not have a filter component.
There are wonderful and comfortable Constraints and even was an attempt to create a filter component with same logic (issue filters on Github), but no one took to do it.

When I once again faced with the task of filtering large amounts of data from a user, I realized that it is time to solve the problem of how to filter data more global/nice/comfortable.

After some research, I realized that there is nothing fundamentally new in filtering on php. There are 2 popular components:

Zend Filter
DMS-Filter

Please note that the last one is not very well supported by the author.
There symfony bundle for DMS-Filter but it is not compatible with the Symfony 3.  I did not like the code for DMS-Filter. I understand that can do everything a little easier.

After analyzing the situation, I realized that the fastest and most reliable way to write a filter bundle, are using the well-documented and test coverage filters -Zend Filters. Just want to add, that in the past, I have worked with Zend Framework 1 and this component was close and clear for me.

I wanted to make the logic of the filters similarly to Symfony Constraints.
The result was written bundle, which adds a service that can be used to filter the object based on the annotations. Also, bundle can filter form object if it is annotated.

Documentation that I used at the time of writing this bundle:

How to Create a Form Type Extension
Form Events
How to Dynamically Modify Forms Using Form Events
How to Register Event Listeners and Subscribers
Documentation and bundle can be found on GitHub FilterBundle.

How to make JMS Serializer and LiipImagine works together

API json

I’m working on writing the API for the front-end on AngularJS. To do this, I use the standard bundles set for Symfony:

FOSRestBundle
JMSSerializerBundle
NelmioApiDocBundle

I had a task to give a reference to thumb and preview in objects that contain pictures. I have already used in the code LiipImagineBundle and for generating links in api also wanted to use this bundle. After a search for the right solution to me, I was surprised that there are no ready-made bundle for this.

Just want to say that I am obviously not a fan of JMSSerializerBundle, as the project is not actively supported giving some limitations when working with it. Symfony Serializer will be better, but life is not so simple) Also, please note that the API, what I write, is scheduled to be open, so it have to be simple for understanding.

Let us return to the subject. Realizing that I need to write my bike I started writing it) As the project for which it was needed not a little, I had to support different configurations. For example the picture may have several filters or one. Since I use to upload data on server VichUploaderBundle, I need make the support of generation links given by this bundle.

In JMSSerializerBundle there are two events that are invoked when the object serializing:

  • serializer.pre_serialize used if we need to change some information in the object. For example in object are picture field with reference to the original picture, and you need to change field data to thumb url.
  • serializer.post_serialize used if you want to add additional information to the  serialized object. For example there are a field image with a link to the original image and it can not be overwritten because it is already used somewhere then we can add a new field image_thumb for example, and put in it a reference to the thumb.

Documentation and bundle are on GitHub LiipImagineSerializationBundle.

Working with HelloSign in Symfony

Hellosign logo

I use HelloSign api on current project. They have PHP sdk but haven’t Symfony bundle.

So at first I use their sdk without symfony integration but in this way you not have dependency injection and working with login parameters not so comfortable. Thats why I decided write wrapper for their SDK.

Documentation and HelloSignBundle at Github.