Daniel Gafitescu Freelance web developer focused on open source solutions



I switched from using Vagrant boxes to Docker .

There are few reasons why I did that :

- starts very fast

- low memory & disk usage

- there is no need to use Virtualbox anymore

- can deploy to AWS , DigitalOcean and Rackspace  same server configuration as on your local

- scale easier

I watched a couple of training videos :

1. Learning Docker from O'Reilly

2. Real World Docker from O'Reilly

Tagged as: No Comments

“Build APIs You Won’t Hate” & “Modern PHP: New Features and Good Practices”

Finish 2 books this holiday that I really like:

1. Modern PHP: New Features and Good Practices
If you are uncertain which programming language you like to learn and you are not sure if PHP is the right way this book will certainly change your mind.









2. Build APIs You Won't Hate

Last year most of my work evolved around API and specially building  REST API. This book gave me confidence that I am on the right track and also what I can improve when moving forward.

While driving I also listen to Rework which was a interesting as well.


​ O’Reilly – Up to Speed with PHP 7

Recently I had updated my VPS Php version to 7. It was easy and pretty smooth. I only had to add a single file so that WordPress would work with mysqli extension instead of old mysql extension which was deprecated.
I wanted to see what's new in Php 7 and I saw that O'Reilly had a course about it so I went and what it. Here is a short review of the course.

Php 7
- first major version release since PHP5 in 2004 after Php6 was abandoned in 2010
- is powered by a new engine PHPNG ( Php new generation)

Changes :

Internal changes
- according to Rasmus Lerdorf 100%+ performance on the most real-world apps
- lower memory usage
on Wodpress 4.1.1 PHP7 is slightly slower than HHVM 3.6.1
- simplifies creating add-on tools
- yield doesn’t require parentheses
- empty list() now allowed
- 64-bit integer support in Windows
- support for strings >= 2^31 on 64-bit builds ( video file conversion as string )
- very few breaks in backward compatibility
- most fatal errors now catchable ( Exception being thrown)
- mysql extension has been deprecated
- new json extension
- assert controller by configuration settings
- posix regex has been removed
- alternative php tags have been removed
- assign of new by reference has been removed

New operators:
- Spaceship operator ( already in Perl & Ruby )

$a = 6;
$b = $c = 10;
echo ($a <=> $b); ==> -1
echo ($b <=> $c ); ==> 0
echo ($c <=> $a) ==> 1

- Null coalesce operator

$variable = $non_existent ?? ‘default’ ;
also can be used in cascade
$var = $non_existent ?? $name ?? ‘default’;

Unicode escape syntax

$name = “Caf\u{00e9}” => Café

- random_bytes(20) ( Usage bin2hex(random_bytes(20));
- random_int(1,6) ==> generate a number between 1 and 6

Return type declaration
- is optional
prevent unintended return values
- forces sub classes to return expected data type

function convertor($string) : array {
return $array;

- Scalar type hinting
used for boolean (bool ), integer(int), float & string
- optional
- have 2 modes week & strong ( is done by declare(strict_types=1);
and needs to be first statement in the file

function multiply(int $a, int $b): int {
return $a*$b;

Anonymous classes
-can be assign to a variable
-return from a function
-pass as argument to a function
-extend a class , implement interface & use traits
- can’t be serialised

$testClass = new class() extends SplHeap {
protect function test($data1,$date2)
return ($data1 <=> $data2);

Generators return expressions

function generate() {
$total = 0;
for($i=1; $i<10;$i++) {
yield $i;
$total += $i;
return $total;
$counter = generate();
foreach($counter as $number)
echo $number;
echo “total = “. $counter->getReturn();

Generator delegation;
Binding to closures at call time;
Grouping Use Declarations

use SomeNamesSpace\SomePackage\SomeClass;
use SomeNamesSpace\SomePackage\SomeOtherClass;
use SomeNamesSpace\SomePackage\SomeDifferentClass;

Some as

use SomeNamesSpace\SomePackage\ {SomeClass, SomeOtherClass , SomeDifferentClass};

- Can be used for constants a function as well & even mix and match;

-catching fatal errors using Error class
-errors and expectations belong to different classes
-both implement the Throwable interface
-errors/exception can be catch in block

Other improvements
-improve security of unserialize;
-preserve 0 fraction when encoding as JSON

Tagged as: , , No Comments

CSS3 In-Depth from pluralsight.com

Watched CSS3 In-Depth just to see what's new in CSS3. Turns out there a lot of stuff but still some of them are not available in all browsers.

It's definitely a good watch if you are a front end developer.