Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Community News:
Latest PEAR Releases (07.28.2015)
Jul 28, 2015 @ 00:05:01

Latest PEAR Releases:

tagged:

Link:

Kevin Ennis:
On Unit Testing
Jul 27, 2015 @ 12:48:31

On Medium.com Kevin Ennis has shared some thoughts on unit testing and how he's "done a 180%" on what kind of value he feels they bring.

There are a lot of really easy ways to rationalize not testing your code, and I’m probably guilty of saying each of them at one point or another. For some engineers, I think the reluctance to embrace unit testing is basically just FUD. Like so many other things, testing seems scary if you haven’t done it before.

But it’s also really difficult to fully understand the benefits of testing unless you’ve worked on a project that has good tests. So it’s easy to see why?—?without fully understanding the upside?—?many developers regard unit testing as an unnecessary step.

He goes through several of the common excuses for not writing unit tests and debunks them one at a time. He also includes a brief section at the end of the post with a recommendation on how to get started testing...essentially "just do it".

tagged: unittest opinion common rationalization fud

Link: https://medium.com/@kevincennis/on-unit-testing-1cc6798f81ee

Symfony Blog:
The Symfony Demo application, three months later
Jul 27, 2015 @ 11:27:02

The Symfony blog has a post that talks about the state of the Symfony "Demo" application three months after its release. The "Demo" application is a simpler way to get an entire Symfony 2 application up and running, giving you a good foundation for either your own development or quick testing.

The [Symfony Demo application](https://github.com/symfony/symfony-demo) was publicly introduced three months ago. In addition to being a learning resource, it's considered the reference implementation of the [Symfony Best Practices](http://symfony.com/doc/current/best_practices/index.html). During the past weeks, we've been busy adding new features to showcase Symfony functionalities. This article is a quick recap of the most important new features.

They talk about four different improvements to the demo setup and configuration process:

  • Full internationalization
  • New console commands
  • New technical requirements checker
  • New JavaScript and Sass/CSS management

They also briefly mention a few other miscellaneous changes at the end of the application around security, debugging helpers and more functional testing.

tagged: symfony demo application improvements symfony2

Link: http://symfony.com/blog/the-symfony-demo-application-three-months-later

Community News:
Latest PEAR Releases (07.27.2015)
Jul 27, 2015 @ 10:36:14

Latest PEAR Releases:

tagged:

Link:

SitePoint PHP Blog:
Console Wars – PHP CLI Libraries
Jul 27, 2015 @ 10:32:35

The SitePoint PHP blog has a post that compares some of the major PHP CLI libraries, three of them at least: the Symfony console component, Hoa console and the Webmozart solution.

I have always been a big fan of console commands and I try to provide a command line interface (CLI) as much as possible in most of my PHP projects. In this article, I’ll briefly compare three PHP console command libraries.

He starts with a brief history on each of the libraries, talking about their origins and age. He then talks about the necessary dependencies each requires and the overall complexity of the code they include. Next up is some practical examples putting each to use outputting a simple message back to the user using user input for both the message and output color.

tagged: console commandline library symfony hoa webmozart cli compare

Link: http://www.sitepoint.com/console-wars-php-cli-libraries/

Michelangelo van Dam:
Speeding up database calls with PDO and iterators
Jul 27, 2015 @ 09:45:28

In a post to his site Michelangelo van Dam shows you how to speed up database calls with PDO and iterators in a "no framework" environment.

When you review lots of code, you often wonder why things were written the way they were. Especially when making expensive calls to a database, I still see things that could and should be improved.

When working with a framework, mostly these database calls are optimized for the developer and abstract the complex logic to improve and optimize the retrieval and usage of data. But then developers need to build something without a framework and end up using the basics of PHP in a sub-optimal way.

He points out some of the common issues with a simple approach using just PDO and simple arrays including performance issues. Instead he recommends the use of iterators that wrap a PDO connection and allow for much simpler fetching and iteration of the found results. He includes code examples for a base iterator instance and a way to extend it to get the customized results. He also includes a few benchmarks showing the difference between a foreach loop and this iterator method.

tagged: database pdo iterator foreach benchmark compare

Link: http://www.dragonbe.com/2015/07/speeding-up-database-calls-with-pdo-and.html

Remi Collet:
New "remi-php70" repository
Jul 24, 2015 @ 13:09:05

Remi has announced the release of the remi-php7 repo, available for Fedora ≥ 21 and Enterprise Linux ≥ 6.

Current version is PHP 7.0.0beta2 with about 25 extensions which are already compatible. This repository provides development versions which are not suitable for production usage. [...] As for other remi's repositories, it is disabled by default, so the update is an administrator choice.

This repository can be installed just like other similar remi repos via the "yum" command to add the repository to the list of available ones, then another to upgrade the PHP installation.

tagged: php7 remi repository available package yum install beta2

Link: http://blog.remirepo.net/post/2015/07/24/New-remi-php70-repository

NetTuts.com:
Understand Overriding in Magento: Controllers
Jul 24, 2015 @ 12:19:45

The NetTuts.com site has posted a tutorial (the third and last in their series) showing how to override controller handling in Magento. In the previous posts they showed how to override functionality related to the models and blocks (frontend layout elements).

In Magento, the controller is responsible for handling incoming requests, and it's a backbone of the Magento routing implementation. [...] As I said in the previous tutorial, it's never recommended to change core files directly, as it makes upgrading Magento really difficult. To avoid this, we should follow the standard way of making desired changes to core files: we should either use event observers or override core files with our custom module files. We'll discuss the overriding feature today.

You'll need to be familiar with custom module creation to be able to follow along (see here if not) but other than that they provide everything you'll need. They start by creating the files and folders needed for the custom module including:

  • Module XML definition (Envato_All.xml)
  • Module XML configuration
  • the Envato_Catalog_ProductController controller file (PHP)

The controller extends the pre-existing Product controller but the configuration definitions tell it ti use the "Envato" version instead.

tagged: magento overriding controller tutorial custom xml module

Link: http://code.tutsplus.com/tutorials/understand-overriding-in-magento-controllers--cms-23386

BitExpert Blog:
Think About It: PHP/PostgreSQL Bulk Performance (Part 3)
Jul 24, 2015 @ 11:46:06

On the bitExpert blog they've continued their "Think About It" series of posts looking at optimizations that can be made to different technologies in their stack to increase performance. In this third part of the series they focus in on the changes made to help speed things up with the PostgreSQL database backend.

This article is the last of a three-part series and describes how we optimized the persistence process of bulk data in our code in combination with PostgreSQL. Make sure you covered the first article about how we tweaked PHPExcel to run faster while reading Excel and CSV files and the second article about how we optimized our data processing and reached performance improvements tweaking our code.

They work from the example code provided at the end of part two and update the "update" handling to optimize it a bit. By default it executes an update query for each record so, instead, they modified it to perform a bulk update with an "update from values" format. They could then migrate to a "save all" handler with the complete set of records to save.

tagged: performance postgresql bulk series part3 tutorial phpexcel excel csv

Link: https://blog.bitexpert.de/blog/think-about-it-php-postgresql-bulk-performance-part-3/

Lorna Mitchell:
Test Your PHP Application on PHP 7
Jul 24, 2015 @ 10:06:53

Lorna Mitchell has a post to her site showing you how to get a PHP7 setup and working so you can test out your current application, preparing it for this next major version's release.

PHP 7 is coming, which is nice, but what does it mean for the majority of PHP developers? PHP as a community is notoriously slow in adoption, some of us are still waiting for 2012's new shiny to be available as standard on our hosting platforms. However with the performance benefits and a few really nice new features, PHP 7 is well worth everyone's attention, and it's actually quite easy to get started so here's my quick howto.

The large part of the post is the steps you'll need to get the php7dev box (from Rasmus Lerdorf) up and running, complete with a shared folder mounted from your local machine and a custom Nginx configuration. She also mentions the "Go PHP7" initiative that's aiming to help make the transition to PHP7 as easy as possible for everyone (including various extensions).

tagged: test application php7 php7dev vm virtualmachine setup configure

Link: http://www.lornajane.net/posts/2015/test-your-php-application-on-php-7