Docker Symfony Setup

github.com/dunglas/symfony-docker Containerize development

Sending Data to Clients

Install PHP AMQP on Mac OS X

brew install rabbitmq-c pecl install amqp

Install PHP Redis on Mac OS X

pecl install redos

Code Snippets

Get a DateTime from a DateTimeImmutable

From PHP 7.3:

DateTime::createFromImmutable($dateTime);

Before:

$dateTime = new \DateTime();
$dateTime->setTimestamp($dateTimeImmutable->getTimestamp());

Random array item

$data = ['A','B','C','D'];
$random = $data[array_rand($data)];

Random future DateTime

$futureDate = DateTime::createFromFormat('U', strtotime( '+'.random_int(1, 30).' days'));

More