PHPDeveloper.org

PHP Town Hall: Episode 30: Specs, Implementations, and New Engines OH MY!

Tue, 08/26/2014 - 21:23

The PHP Town Hall podcast has posted their latest episode today with hosts Phil Sturgeon and Ben Edmunds with a few special guests: "Specs, Implementations, and New Engines OH MY!"

This week Ben and Phil are joined by core PHP developer extraordinaires Andrea Faulds and Levi Morrison. We discuss the new PHP engine spec, various RFCs, and all things internals. Also PHP 6 is officially dead, let's have a moment of silence.

You can check out this latest episode either through the in-page audio player, by downloading the mp3 directly. You can also watch the live recording from the Google Hangout over on YouTube.

Link: http://phptownhall.com/blog/2014/08/25/episode-30-specs-implementations-and-new-engines-oh-my/

Matthias Noback: Decoupling your (event) system

Tue, 08/26/2014 - 17:15

Matthias Noback has continued his look at event handling in PHP applications (well, Symfony-related ones at least) in his latest post. In this latest post he focuses more on abstracting out the event handling process and decoupling it from your application as much as possible.

You are creating a nice reusable package. Inside the package you want to use events to allow others to hook into your own code. You look at several event managers that are available. [...] Introducing this dependency is not without any problem: everybody who uses my/package in their project will also pull in the [event dispatcher] package, meaning they will now have yet another event dispatcher available in their project (a Laravel one, a Doctrine one, a Symfony one, etc.). This doesn't make sense, especially because event dispatchers all do (or can do) more or less the same thing.

As mentioned, he focuses in on the Symfony ecosystem and the event handlers commonly used there. He talks about some of the disadvantages of the Symfony EventDispatcher and how its interface can lead to code bloat due to it's verbosity (flexibility?). He talks about its violations of the Interface Segregation Principle and how he would structure the listener setup and handling if he was starting from scratch. To this end, he's created an adapter that wraps around an EventDispatcher interface and works with objects for the different kinds of events rather than the string names.

Link: http://php-and-symfony.matthiasnoback.nl/2014/08/symfony2-decoupling-your-event-system/

SitePoint PHP Blog: PINQ - Querify Your Datasets - Faceted Search

Tue, 08/26/2014 - 16:58

The SitePoint PHP blog has continued their series showing the use of the PINQ library for PHP (a PHP implementation of the LINQ tool). In part one they introduced the tool and showed how to it could be used to query and sort data. In this second part they move on and show how to perform a multi-faceted search on data from a MySQL database.

We are not going to cover the full aspect of faceted search in this series. Interested parties can refer to relevant articles published on Sitepoint and other Internet publications. [...] Unfortunately, faceted search is not a built-in feature provided by MySQL yet. What can we do if we are using MySQL but also want to provide our users with such a feature? With PINQ, we'll see there is an equally powerful and straightforward approach to achieving this as when we are using other DB engines - at least in a way.

Building from the code from the first part of the series, they create a few more simple routes that let you define the different facets to use for the searching/sorting. He creates a custom facet class that uses the "traversable" handling of the PINQ to do the data manipulation. He creates a few different facet objects, each creating a customized filter. finally, he ties it all back into the endpoint and includes the updated markup to show the results. He finishes up the post mentioning a few limitations and improvements that could be made on the example as well.

Link: http://www.sitepoint.com/pinq-querify-datasets-faceted-search/

Rob Allen: Integrating ZF2 forms into Slim

Tue, 08/26/2014 - 15:40

Rob Allen has a helpful post if you've ever wanted to take advantage of the simplicity of the Slim framework and the power of the Zend Framework 2 forms. In this latest post he walks you through the process of setting it all up and using the ZF2 elements outside of the main framework.

Let's say that you want to use Zend Framework 2′s Form component outside of ZF2 itself. In this case, a Slim application. It turns out that Composer makes this quite easy, though there's quite a lot of code involved, so this is a long article. Start with a really simple Slim Application...

His simple Slim application - just one route - handles both the GET and POST actions and uses several ZF2 components besides just the Form (dependencies mostly). He shows you the updates and additions you'll need to make to the service manager configuration and how to set up some custom validation and the form object in the controller. His example form only has two elements, an email field and a submit button and validation is done on the email address when it's submitted. Finally he includes the View object, extended from Slim's that combines some of the ZF2 and Slim handling to correctly render the form.

Link: http://akrabat.com/zend-framework-2/integrating-zf2-forms-into-slim/

Community News: Packagist Latest Releases for 08.26.2014

Tue, 08/26/2014 - 14:00
Recent releases from the Packagist:

Community News: Latest PECL Releases for 08.26.2014

Tue, 08/26/2014 - 13:09
Latest PECL Releases:
  • SeasLog 1.1.4 - Define some function at header for C99 Standard - Remove some superfluous comment - Fixed SeasLog::log() function warning - Fixed config "seaslog.level = 0" in Readme

  • pecl_http 2.1.0RC3 Changes from RC2: * Fixed PHP-5.3 compatibility * Fixed possible bus error on shutdown when using events + Added curlcode transfer info - Removed port and scheme guessing of httpUrl for portability

php[architect]: August 2014 Issue Released - Beyond PHP

Mon, 08/25/2014 - 18:46

The latest issue of the php[architect] magazine has officially been released - August 2014, Beyond PHP.

In an increasingly multi-hat career environment, most PHP Devs are often asked to knock out some front end development from time-to-time. This is not as unusual as you may think. Having learned coding in the home-baked-what-the-hell-are-we-doing-dot-com 1.0 world, we were often expected to do everything from cradle to grave. While duties are a lot more (and rightfully so) siloed between front and back end developers than in 1998, we are still expected to (at least) understand the different life-cycles of web development and design.

The articles in this month's issue include a wide range of topics including:

  • "MeteorJS - It's Not PHP But Darn It's Cool" (Alan Blount)
  • "Building a Plugin System with Composer" (Maarten Balliauw)
  • "A Modern Front End Through the Eyes of a PHP Developer" (Aurelio De Rosa)
  • "The Confident Coder: What Type Are You?" (Aaron Saray)

You can pick up a copy to call your own (either print or digital) directly from the php[architect] site. If you like the magazine, consider picking up a year subscription too!

Link: http://www.phparch.com/magazine/2014-2/august/

SitePoint PHP Blog: Build a New App with Laravel and EmberJS in Vagrant

Mon, 08/25/2014 - 17:31

The SitePoint PHP blog has kicked off another series of posts today with part one of a series looking at building an application based on the Laravel PHP framework and EmberJS.

Nowadays, everything is turning into a web application. Even simple websites have a mobile app relying on a REST Api. Web applications are accessible everywhere - on a laptop, desktop, tablet, mobile, and recently on wearable devices like smartwatches. Everything is becoming smaller and faster - front ends are becoming separated from back ends, and only communicate with the server through APIs. In this series, we are going to create a photo uploading app. For the front-end, we will use EmberJs and Foundation 5. [...] For the back-end, we will use Laravel. The source code will be available per-part, and in final shape in the final part of this series.

They go with the Laravel Homestead virtual machine (and Vagrant) to make for a quick setup and stable environment. They help you get it all set up to push up to Heroku and get all needed dependencies, both frontend and backend, installed. They also walk you through the setup of the database, configuring the connection and deploying the application to production.

Link: http://www.sitepoint.com/build-new-app-laravel-emberjs-vagrant/

Matthias Noback: Symfony2: Event subsystems

Mon, 08/25/2014 - 16:07

In his latest post Mathias Noback takes a look at the Symfony2 event subsystems and the answer to a common problem he's had with it in the past: circular references.

Recently I realized that some of the problems I encountered in the past could have been easily solved by what I'm about to explain in this post. [...] The problem is: having a complicated graph of service definitions and their dependencies, which causes a ServiceCircularReferenceException, saying 'Circular reference detected for service "...", path: "... -> ... -> ...".' Somewhere in the path of services that form the circle you then find the event_dispatcher service.

He shows the wrong way to solve the problem first by injecting a service container into the listener and using services directly from there. In his "entirely different and much better way" he shows a solution that removes dependencies on the main event dispatcher. He shows how to use the event subsystems to avoid this link and gives a more concrete example for domain-related events (with both code and config).

Link: http://php-and-symfony.matthiasnoback.nl/2014/08/symfony2-event-subsystems/

Matthew Weier O'Phinney: Testing Code That Emits Output

Mon, 08/25/2014 - 15:45

In this latest post to his site Matthew Weier O'Phinney gives his suggestion on how to test (unit test) code that provides some kind of direct output. In his case, his script is outputting header information directly, not as a part of a response string.

Here's the scenario: you have code that will emit headers and content, for instance, a front controller. How do you test this? The answer is remarkably simple, but non-obvious: namespaces.

He talks some about the use of namespaces in PHP classes (and methods, and constants...) and how things can be importing using them. He gives an example of an object that outputs some header and body information (an "Output" abstract class). He shows how to use the class in a simple test, calling "reset" in the setup and teardown methods and asserting the contents of the headers and body for expected content.

Link: http://mwop.net/blog/2014-08-11-testing-output-generating-code.html

Community News: Packagist Latest Releases for 08.25.2014

Mon, 08/25/2014 - 14:02
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 08.24.2014

Sun, 08/24/2014 - 14:00
Recent releases from the Packagist:

Community News: Packagist Latest Releases for 08.23.2014

Sat, 08/23/2014 - 14:08
Recent releases from the Packagist:

PHP.net: PHP 5.4.32 Released

Fri, 08/22/2014 - 18:48

The PHP development team has officially announced the release of the latest version in the PHP 5.4.x series that fixes several security issues: PHP 5.4.32.

The PHP development team announces the immediate availability of PHP 5.4.32. 16 bugs were fixed in this release, including the following security-related issues: CVE-2014-2497, CVE-2014-3538, CVE-2014-3587, CVE-2014-3597, CVE-2014-4670, CVE-2014-4698, CVE-2014-5120. All PHP 5.4 users are encouraged to upgrade to this version.

You can view the full list of changes and what part of the language they effect in the changelog. To download this latest version, you can get the source from the downloads page or windows.php.net for Windows users.

Link: http://php.net/index.php#id2014-08-21-1

NetTuts.com: Five Hidden Gems of Laravel

Fri, 08/22/2014 - 17:51

The NetTuts.com site has posted a list of their five hidden gems in Laravel, a popular PHP framework. They look at a wide range of these "hidden" features that can help make your Laravel experience even better.

Many developers who use Laravel are probably only barely scratching the surface of what the framework has to offer. While the documentation does cover the most common use cases and the obvious features, it doesn't cover everything. Don't get me wrong, the documentation is fine, it's just that there's so much you can do, it's hard to document everything. Because of that, we're going to take a look at some of the hidden gems that lurk within Laravel.

The five items on their list come complete with summaries about the feature, when they were added, if they're documented and a code sample with them in use:

  • Cascading Views
  • Collections (with sorting, filtering and pagination)
  • Regular Expression Filters
  • The Message Bag
  • Fluent
Link: http://code.tutsplus.com/articles/five-hidden-gems-of-laravel--cms-21907

Qandidate.com Blog: How we manage our development process at Qandidate.com

Fri, 08/22/2014 - 16:34

The Qandidate blog has a new post today that "pulls back the curtain" as to how they manage their development process and get their work done.

At Qandidate.com we tried a lot of different project management tools and techniques. After two years of experimenting I want to share our current process, seen from my role as product owner (PO). One reason for sharing this, is to help you improve your process, but the most important reason is to start a discussion with you based on your experience, to improve our process even more. Our main rule at Qandidate.com is to embrace change. Always be open for changes that may or may not improve your process. If a change improves the process it's a win. If you didn't try it you will never know!

They walk through the three main points over the overall flow of work there:

  • The process itself including two week sprints containing (unestimated) stories
  • A demo and stakeholders meeting showing the work they've done during the sprint and get feedback from the stakeholders
  • The stories and how they're created and when/how new ones are added (their "piano meetings").

They also include testing, both frontend and backend, and focus on small chunks of functionality instead of quick and dirty hacks. While their process won't work for every group (and is more of a "scrum-but..." setup) it is interesting to see how another group does their work.

Link: http://labs.qandidate.com/blog/2014/08/21/development-process-at-qandidate-com/

Derick Rethans: On Backwards Compatibility and not Being Evil

Fri, 08/22/2014 - 15:20

Derick Rethans has shared some of his thoughts on how to not be evil when it comes to making changes in languages like PHP. He suggests that any backwards compatibility break should be treated with the weight it deserves and not just thrust upon users.

This is a repost of an email I sent to PHP internals as a reply to: "And since you're targetting[sic] the next major release, BC isn't an issue." This sort of blanket statements that "Backwards Compatibility is not an issue" with a new major version is extremely unwarranted. Extreme care should be taken when deciding to break Backwards Compatibility. It should not be "oh we have a major new version so we can break all the things"

He talks about the two kinds of backwards compatibility breaks: obvious things where features are removed or changed in a major way and subtle changes in how the underlying code for PHP works ("subtle changes"). He points out that most of the frustrations from users comes from the second type, making for a slower adoption rate and maybe not even adopting at all.

Can I please urge people to not take Backwards Compatibility issues so lightly. Please think really careful when you suggest to break Backwards Compatibility, it should only be considered if there is a real and important reason to do so. Link: http://derickrethans.nl/bc-dont-be-evil.html

Community News: Packagist Latest Releases for 08.22.2014

Fri, 08/22/2014 - 14:02
Recent releases from the Packagist:

Tobias Hermann: Programming language subreddits and their choice of words

Thu, 08/21/2014 - 18:14

Tobias Hermann has put together some interesting statistics pulled from the various programming subreddits on the Reddit.com site. He measures the choice of words for each community based on how own they're used.

While reading about various programming languages, I developed a hunch about how often different languages are mentioned by other communities and about the average conversational tones used by relative members. To examine if it was just selective perception on my site, an unconscious confirmation of stereotypes, or a valid observation I collected and analysed some data, i.e. all comments (about 300k) written to submissions (about 40k) in respective programming language subreddits from 2013-08 to 2014-07 using PRAW and SQLite. In this article I will present some selected results.

He first covers the "mutual mentions" for each of the groups with the largest connection from the PHP subreddit being to Python. He also compares the results to the TIOBE index for each (average popularity). He gets into more details about the words used (abstract, category, pure, etc) with PHP placing somewhere roughly in the middle for most data sets. The most interesting result, however, came with the set of curse words and the frequency of their use. In the PHP Reddit community the usage of these terms is, by far, the most of any group. Unfortunately, PHP also ranks lower on the "happiness" scale.

If you're interested in seeing how he came up with these results, you can get the raw results and the code he used.

Link: https://github.com/Dobiasd/programming-language-subreddits-and-their-choice-of-words/blob/master/README.md