php

Security Upgrade Breaks Composer

While setting up a fresh Symfony installation, I discovered my composer was broken. When I ran this. composer update I got this. The “https://packagist.org/packages.json” file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable crypto failed to open stream: operation failed https://packagist.org could not Security Upgrade Breaks Composer

Symfony Rebuild bootstrap.php.cache

If you feel the urge to rebuild your bootstrap.php.cache located in your app directory, run this from the command-line. php ./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php I’ve not actually found rebuilding the cache to be particularly useful. I just needed to it once because I thought it was causing me problems, it wasn’t.

Symfony Suppress Header Output

Here’s how to suppress the header out in a Symfony controller. I was busting out a simple controller to handle the csv download of a log file and I kept getting this in the output. HTTP/1.0 200 OK Cache-Control: no-cache Date: Mon, 01 Feb 2016 21:39:07 GMT The problem was that I was calling render Symfony Suppress Header Output

PHP 7 Dropped

I missed the news, but on December 3, PHP dropped version 7. I don’t know what happened to version 6, but version 7 is a major update from PHP 5.6. PHP 7 comes with a new version of the Zend Engine, numerous improvements and new features such as Improved performance: PHP 7 is up to PHP 7 Dropped

PHP’s Foreach is the Fastest

I have always assumed that using PHP’s foreach loop was the easiest, but not the fastest way to loop through an array. I also assumed that the PHP *array_** functions were the preferred method, as the PHP developers would be able to do some super-efficient magic to make these function super fast. Apparently, I was PHP’s Foreach is the Fastest

Symfony Upgrades Too Quickly

I love Symfony, it’s definitely my go-to PHP framework, but I don’t like how quickly they drop support for versions. For instance, version 2.6 is already end-of-life and it came out in November 2014. That was like one year ago and we’re all being forced to upgrade to Symfony 3.0. The new version of Symfony Symfony Upgrades Too Quickly

How to Use Symfony’s Monolog for Logging

Monolog is the logging bundle for Symfony. It’s super easy to use. You just need to pull in the “logger” service and call the “error” or “info” method. In a controller you could do something like this. $logger = $this->get(‘logger’); $logger->info(“I’m logging over here”); $logger->error(“Who dat err?”); Obviously, you can do a lot more than How to Use Symfony’s Monolog for Logging