Snappy – How to create PDF with Symfony and twig

Long time ago I use FPDF to create PDF Documents and reports. FPDF allows you to define a PDF using blocks. This process is slow as you can not reuse any of the views you already code in html or your frontend components.

For a long time there has been a new player wkhtmltopdfwkhtmltopdf is a headless chrome port that generate PDF’s or Images from a website and you can use it in Symfony with Snappy bundle.

Continue reading

Store aws beanstalk symfony and apache logs in cloudwatch logs

Do you have a symfony app deployed with autoscale capabilities in aws beanstalk and you don’t have a central logging server? Then you may find this post especially relevant.

When your app scale up and down your server created and destroyed dynamically. During this process you loose your logs. This logs may be extremely useful if something goes wrong in your system. Moreover it may be required by local legislation to keep a copy of it.

This will be a recipe on how to setup Cloudwatch logs as a central log storage in AWS. The example is based on a symfony app but with minor adjustments it will work for any LAMP project.

Continue reading

Create your own certificate authority

Why to create your own certificate authority?

Recently I start using my own cloud service storage owncloud to replace dropbox in some scenarios. I wanted to access to my documents throw SSL and for that reason I start checking how to self sign a certificate. Afterwards I realized that I also wanted to protect other websites with my SSL and I decided to create my own Certificate Authority CA. The main reason to create the Certificate Authority is to have only one certificate to install on my devices instead of each of the multiple certificates. Continue reading

XDebug and PHP setup for Mac OSX

Debugging PHP it shouldn’t be painful. XDebug it’s a fantastic PHP extension that provide debugging capabilities. The setup procedure it is easy and it already comes ready to go on XAMP and WAMP.

Let’s start for the mistake when someone try to “debug” a code for the first time. When you are digging into unknown behavior in your code you are running web server while you edit your code and press F5 compulsively. Add a die there, var_dump there and see if there is what you expect until you found something unexpected and start following that clue again. Continue reading