PHP

How to pass ENV variables to PHP

How to export variables to PHP in secure way

It’s not a good practice to store your password in the code. It is a well-known fact, and on multiple occasions, people get hacked because they share their code (and passwords) accidentally with others.

Many bots are just browsing GitHub for lost AWS_SECRET_ACCESS_KEY or GCE credentials. I’m going to show you how to pass your AWS_SECRET_ACCESS_KEY to PHP.

Never use file_get_contents to make URL queries

Why you should not ever use file_get_contents

As each programmer by nature, I’m lazy. I try to accomplish as much as possible with minimum effort.

So whenever I use PHP to fetch something, I use file_get_contents to make queries and pull data from other services. So basically, my favourite snippet is this guy here:

PrestaShop margin size on delivery slips

Recently one of my clients contacted me asking if I could make a change. The task was to shrink huge margins on PDF delivery slips. The mission wasn’t easy because the settings were hidden in the files. You can change font size and amend or remove elements from the printout by modifying templates. Unfortunately, you can’t decrease the margin on PDF printouts.

PHP returning wrong date

PHP returning wrong date

From time to time we are working on small campaigns, where competition starts at given time. Because in Australia we have “so many” timezones, it’s critical to set things correctly according to the time zone.