Web Development

All posts tagged Web Development

How to manage static images with Symfony’s Webpack Encore

Any web project has basically 4 kind of places where images reside:

  1. In the CSS;
  2. In a font file (think at icons);
  3. In the cloud (think at AWS S3);
  4. In the project itself as static files.

Symfony’s Webpack Encore is great to manage the first two places as it is able to manage the images referenced in the CSSes and to manage fonts (as they are handled as CSSes are).

The third group of images, the ones in the cloud, have not to be managed by Webpack but by another bundle like LiipImagineBundle.

So we are left only with the fourth group: the static images.

read more
AerendirHow to manage static images with Symfony’s Webpack Encore

Magento 2: SSL certificate problem: unable to get local issuer certificate (cURL problem)

The message “SSL certificate problem: unable to get local issuer certificate” shows up when trying to connect to Magento Connect or when, generally, you try to use cURL to connect to a remote web site.

This error happens because cURL cannot find a cacert.pem file from which take the trusted signatures.

read more
AerendirMagento 2: SSL certificate problem: unable to get local issuer certificate (cURL problem)

How to install XCode Command Line Tools

XCode is the development environment provided by Apple and it contains a set of tools useful for development.

One of this tools is XCode Command Line Tool that

[…] gives terminal users many commonly used tools, utilities, and compilers, including make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp, what, and many other useful commands that are usually found in default linux installations.

From OSX Daily

To install XCode Command Line Tools, you DON’T have to first install XCode.

read more
AerendirHow to install XCode Command Line Tools

How to set the $PHP_AUTOCONF environment variable in MAMP (in 2 steps)

If you receive this error trying to install some new binaries using MAMP (for example, installing Intl PHP module), then there is a chance you’ll get this error in your Terminal:

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

This happens because you haven’t the Autoconf binaries installed.

So, let’s install the Autoconf binaries in MAMP.

read more

AerendirHow to set the $PHP_AUTOCONF environment variable in MAMP (in 2 steps)

How to install PHP Intl module in MAMP

Intl (Internationalization) Extension

[…] is a wrapper for » ICU library, enabling PHP programmers to perform » UCA-conformant collation and date/time/number/currency formatting in their scripts.

It is really useful, as, with it, you can, for example, manage currencies and money values in the simplest way possibile (examples at the end of this post).

It is also required by some advanced framework as Symfony to work with international values.

So, let’s install Intl PHP extension…

read more
AerendirHow to install PHP Intl module in MAMP

How to make Terminal use MAMP’s PHP (in only 3 steps)

In MacOSX there is a default Apache + PHP server.

When you type the php command in Terminal, the PHP version used is the one shipped with the MacOSX.

But, if you install MAMP, then what you want is that the version used is the one shipped with MAMP.

So, let’s make Terminal aware of the existence of the MAMP’s PHP binaries and use them instead of the ones shipped with MacOSX.

read more
AerendirHow to make Terminal use MAMP’s PHP (in only 3 steps)

Value Objects, Immutable objects and Doctrine Embeddables

I was thinking about some entities I need, when I came across a very interesting concept: Immutable Objects.

The Immutable Objects are very handy to manage the so called Value Objects.

In the Domain Driven Design (DDD) properties of an Entity can have two different values: other Entities (Order->getProduct() – here Product is an Entity and its properties can change) or simple values (Product->getPrice()).

Price, in our example, is a simple value, not conceptually an Entity. Until now, it probably is a simple property in your Entities (as it was in mine!).
But, in this second case, the Value Objects play their parts: they represent those values in an immutable state.

In fact, if you reflect about the data Price , you realize that a Price is something like “100 Eur”. If you put your attention on the value, you can recognize more than one smaller parts in it: a numeric value – 100 – and a string value – Eur.
A Price is a Price only if we indicate both the numeric part of it (100) and the string part of it (Eur): If we indicate only one of the two, it is not a Price because we don’t know how much money does it represents or in which currency the price is expressed.
So we need both the “amount” and the “currency” to have a real value. Think it as a “composite value”.

And the important thing to consider to understand what Immutable stands for: if in the Price we change the amount, we have a different price. If in the Price we change the currency, we have, again, a different price.
But if in a Product we change the Price, we don’t have a different Product but the same one with only a different Price.

read more
AerendirValue Objects, Immutable objects and Doctrine Embeddables