PHPDeveloper.org

Three Devs & A Maybe Podcast: Episode #56: The SOLID Podcast

Thu, 01/29/2015 - 18:20

In the latest show from the Three Devs & A Maybe podcast hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann talk about a wide range of topics with a focus on the SOLID development principles.

This week we have a three developer podcast with discussion on a host of topics. We kick off with how Fraser has enjoyed building his first bonus slot game, written entirely in JavaScript and HTML5. Preprocessors are a huge part of the JavaScript ecosystem at this time, with so many to choose from we discuss a couple of the more popular ones. This leads on to Photoshop discussion, ReactJS, the cool features present in ES6 and how you can use them today with transpilers. Following this we move on to the SOLID principles, the overuse of inheritance, technical debt and the concept of Over-DRY vs. Software Value. This then takes us on to a strange 'rubber duck' example Edd conjured up to help try and explain the Liskov substitution and Interface segregation principles. Finally, we discuss Edd's media server setup and how he has got it to a staged that he is finally happy with it.

Other topics include things like:

You can listen to the latest show either through the in-page audio player or by downloading the mp3 of the episode. Also, be sure to subscribe to their feed of you enjoy the show!

Link: http://threedevsandamaybe.com/the-solid-podcast/

Community News: Announcing the Pacific Northwest PHP Conference (Seattle, WA)

Thu, 01/29/2015 - 17:53

The Seattle PHP User Group has decided to follow along with the example set by many other PHP user groups in the past several years. They have officially announced the Pacific Northwest PHP Conference and a Kickstarter campaign to help raise the funding to help make it a reality.

The Seattle PHP User Group (SeaPHP) has been around for over 10 years. We love PHP, and we want to build up our local PHP community even further by hosting a PHP developer conference here in Seattle-the technology hub of the Pacific Northwest and cloud computing capital of the world. We invite PHP developers everywhere, and of all skill levels, to come learn, network, and hack together with us in the Emerald City at the first Pacific Northwest PHP Conference (PNWPHP).

The goal of the campaign is to raise some of the initial funding needed to generate more interest for the event, presell tickets and even attract sponsors. The conference itself is planned for September 11th and 12th of 2015 there in Seattle, Washington at the Impact Hub coworking space. If you'd like more information about the conference and updates as they come along, be sure to subscribe to their mailing list and consider helping the PHP conference community grow and contribute today!

Link: https://www.kickstarter.com/projects/seattlephp/pacific-northwest-php-conference-pnwphp

Voices of the ElePHPant: Interview with Jacob Mather

Thu, 01/29/2015 - 16:41

The Voices of the ElePHPant podcast has posted their latest episode in their interviews with members of the PHP community. In this latest show host Cal Evans talks with Jacob Mather, a co-organizer of the San Francisco PHP Meetup group.

They talk some about Jacob's more recent migration into the world of devops and what he enjoys about it. He talks about the work he does to make sure the developers don't have to worry as much about the environment. They also talk about his involvement in the SF.PHP user group and some of the exciting things they're doing.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the interview, be sure to subscribe to their feed.

Link: http://voicesoftheelephpant.com/2015/01/28/interview-with-jacob-mather/

Matthew Weier O'Phinney: PSR-7 By Example

Thu, 01/29/2015 - 15:13

As a part of his involvement in the PHP-FIG standards group, Matthew Weier O'Phinney has been contributing to the PSR-7 proposal. This proposal defines a standardized structure for HTTP message handling. In his latest post he gets into a bit more detail on what this means for the PHP developer and how it might be implemented.

PSR-7 is shaping up nicely. I pushed some updates earlier this week, and we tagged 0.6.0 of the http-message package last week for implementors and potential users to start coding against. I'm still hearing some grumbles both of "simplify!" and "not far enough!" so I'm writing this posts to demonstrate usage of the currently published interfaces, and to illustrate both the ease of use and the completeness and robustness they offer.

He starts with a base definition of what the proposal, well, proposes around HTTP messaging, both the incoming and outgoing. He describes the basic structure of an HTTP message and what each part represents. He talks about message headers, bodies and how the current library could return that content. He then looks at requests vs responses, server-side requests and some various uses cases and more practical examples:

  • HTTP Clients
  • Middleware
  • Frameworks

With the PSR-7 standard in place, all of these different tools could have interchangeable interfaces for HTTP request/responses, easily swappable with any other implementation.

Link: https://mwop.net/blog/2015-01-26-psr-7-by-example.html

Community News: Packagist Latest Releases for 01.29.2015

Thu, 01/29/2015 - 14:00
Recent releases from the Packagist:

SitePoint PHP Blog: Basic TDD in Your New PHP Package

Wed, 01/28/2015 - 18:27

The SitePoint PHP blog continues their "How to Build Your Own PHP Package" series with their latest post (part two of the series) covering the use of test-driven development while working on the package code.

In part 1, we set up our development environment, baked in some rules as inherited from The League, and created two sample but useless classes - Diffbot and DiffbotException. In this part, we'll get started with Test Driven Development.

He starts by briefly introducing PHPUnit, a PHP-based unit testing tool, and how to use it to generate the HTML version of the code coverage report. He helps you define a good phpunit.xml configuration file and how to execute a first sample test (code provided) from inside PHPStorm. From there he adds one some more complex testing of exception handling and checking the class types. With this foundation, he moves into the test-driven development (TDD) practices. TDD means writing the tests before writing the code to make those tests pass. He gives an example of this and shows how test abstract classes too. He then comes back around and writes the code to satisfy the test.

Link: http://www.sitepoint.com/basic-tdd-new-php-package/

Matt Stauffer: Laravel 5.0 - Generating Missing Events

Wed, 01/28/2015 - 17:53

In the next part of his series introducing the upcoming version of the Laravel framework Matt Stauffer has posted part 16, about generating missing events.

Sometimes it can seem like a lot of work to create an event, create its handler, and bind the two. Create a command, create its handler, bind the two. I've often wished for a workflow that handled the whole process together in one. The artisan commands for generating commands and events are a good start--they both create their own entity and (optionally) its handler. But you still can spend an hour writing the command and handler, and then waste another 15 minutes trying to figure out why it's not working, only to realize you never actually bound the two together.

The solution to this in Laravel 5 is the "event:generate" handling with the artisan command line tool. He includes a look at the event handlers directories and files before executing the command and what changes post-execution, including the sample code generated for the event.

Link: http://mattstauffer.co/blog/laravel-5.0-generating-missing-events

thePHP.cc: PHP breaks backwards compatibility

Wed, 01/28/2015 - 16:41

In this new post on thePHP.cc blog Stefan Priebsch talks about some of the backwards compatibility breaks that will be coming with PHP's next major version, PHP7.

According to the PHP project's current time line, PHP 7 is scheduled to be released later this year. The version number 6 will be skipped for good reasons. As is expected of a new major release, there will be some breaks in backwards compatibility. Such breaks are always a double-edged sword: some have been eagerly awaiting the removal of legacy features, others expect that existing software keeps working without modifications. The PHP project is notorious for keeping some sins of the past dating back to PHP 3 in an effort to ensure backwards compatibility. Now, with the release of PHP 7, the decision has been made to remove some features that have been marked as "deprecated" in PHP 5.

He talks about how PHP will be "re-engineered" for this major release including a uniform variable syntax and some of the things this could break (like Magento 1). He also mentions the removal of the mysql (not mysqli) extension and a major issue - that PEAR has stopped working in recent versions of PHP7 (built from the current codebase) because of how it calls non-static methods statically.

Link: http://thephp.cc/news/2015/01/php-breaks-backwards-compatibility

Loosely Coupled Podcast: Episode 18: Best Practices

Wed, 01/28/2015 - 15:15

The Loosely Coupled podcast, hosted by PHP community members Jeff Carouth and Matt Frost, has posted their latest episode - Episode 18: Best Practices. In it they talk about "best practices" as it relates to teams and working with other developers.

In this episode Jeff and Matt will talk about their experiences of getting teams moving on good practices. They will cover times when it has been challenging to convince higher-ups the value of doing certain things, all the way to how to go about changing teams by example. This episode is sponsored by our friend, Coderabbi, who is currently on the Wisdom as a Service World Tour 2015.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3. If you enjoy the show, be sure to check out previous episodes and subscribe to their feed.

Link: http://looselycoupled.info/blog/2015/01/26/episode-18-best-practices/

Reddit.com: What changes would you like to see in PHP 7?

Tue, 01/20/2015 - 18:51

In the /r/php subreddit on Reddit.com a question was posed to the community: What changes would you like to see in PHP 7?. So far there's 80+ answers with a wide variety of responses.

As well as massive performance improvements, PHP 7's change / feature list is already looking great. You can find most of the features that have been accepted or are under discussion on the PHP Dev Wiki: RFCs section. But what changes would make a difference to you? What would you really like to see make it in (already suggested or a new suggestion)?

Here's just a few of the suggestions made by fellow Reddit users:

  • fixing inconsistencies in naming
  • sandboxed eval
  • a complete rework of the standard library
  • the introduction of generics
  • adding enum functionality
  • type aliasing
  • stack traces for fatal errors

Check out the full post for more ideas and feedback from other members of the community too. It's an interesting list of suggestions, some that are even already in the works.

Link: http://www.reddit.com/r/PHP/comments/2sx5x3/what_changes_would_you_like_to_see_in_php_7/

SitePoint PHP Blog: How to Encrypt Large Messages with Asymmetric Keys and phpseclib

Tue, 01/20/2015 - 17:40

On the SitePoint PHP blog today David Brumbaugh shows you how to encrypt large messages with phpseclib and asymmetric keys. phpseclib is a PHP library specifically designed to handle encryption and decryption in an easy-to-use way.

Most of us understand the need to encrypt sensitive data before transmitting it. Encryption is the process of translating plaintext (i.e. normal data) into ciphertext (i.e. secret data). During encryption, plaintext information is translated to ciphertext using a key and an algorithm. To read the data, the ciphertext must be decrypted (i.e. translated back to plaintext) using a key and an algorithm. [...] A core problem to be solved with any encryption algorithm is key distribution. How do you transmit keys to those who need them in order to establish secure communication? The solution to the problem depends on the nature of the keys and algorithms.

He talks some about the difference between symmetric and asymmetric algorithms and some advice about the selection of the right one (or ones) to use in your app. He also talks briefly about the problem with RSA keys, mostly that it has limits on the amount of text it can encrypt. His solution is to "encrypt the message with a symmetric key, then asymmetrically encrypt the key and attach it to the message". He explains the encryption/decryption process step by step and starts in showing the code to make phpseclib do the work. He shows how to generate the keys, build the encrypt function and the decrypt function with about 30 lines of code each.

Link: http://www.sitepoint.com/encrypt-large-messages-asymmetric-keys-phpseclib/

Liip Blog: New Relic extension for HHVM updated to latest version

Tue, 01/20/2015 - 16:04

In his latest post to the Liip blog Christian Stocker points out that the New Relic extension for HHVM has been updated for the latest versions of HHVM to work a bit more seamlessly.

Since HHVM 3.4 it's theoretically possible to have your own external profiler for function level profiling (like xhprof or xdebug) without having to recompile HHVM itself. Unfortunately it wasn't perfect (or I couldn't make it running), but there's a patch in the master branch now (the upcoming 3.6), which seems to solve that problem. So I worked a little bit on my extension in the last few days and I adjusted a lot of things and improved some other stuff.

He talks about the improvements New Relic has made on their functionality and some slowness that still exists in the "hotprofiler". He points out, however, that if you just want overall statistics and not specific, method level ones, you don't really even need to use it. He offers a word of caution when using his extension and when it may fall back to "userland level profiling" instead.

Link: http://blog.liip.ch/archive/2015/01/19/new-relic-extension-for-hhvm-updated-to-latest-version.html

Voices of the ElePHPant: Interview with John Coggeshall

Tue, 01/20/2015 - 15:40

The Voices of the ElePHPant podcast has posted their latest community interview today, this time with John Coggeshall, a PHP core developer.

In this episode Cal and John talk about where open source has been, where it's going and why John thinks that might not be the best direction to go. He suggests that the focus has moved away from people being invested in a project for the sake of it and has "lost it's independence". He uses the term "corporate source" to describe what he sees as the current state of open source on the web.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 for listening at your leisure. If you enjoy the episode be sure to subscribe to their feed and get the latest episodes as they're released.

Link: http://voicesoftheelephpant.com/2015/01/20/interview-with-john-coggeshall/

Community News: Packagist Latest Releases for 01.20.2015

Tue, 01/20/2015 - 14:08
Recent releases from the Packagist:

Community News: Latest PECL Releases for 01.20.2015

Tue, 01/20/2015 - 13:02
Latest PECL Releases:
  • solr 2.1.0 - New Feature: SolrDisMaxQuery Builder (dismax/edismax) [Feature #67101] - Support PHPS (PHP Serialized) Response Writer [Request #61329] - SolrResponse::getArrayResponse [Feature #67660] - SolrResponse::getResponse() returns SolrObject instead of array (with json response writer) [Bug #67579] - Argument list parameter: Argument to value separator disappears [Bug #68179] - Conflict Occurs When using SolrDisMax::addBoostQuery and setBoostQuery [Bug #68181] - Doc Fix [Doc #67542] - Internals: simple_list parameter type allow custom delimiter - Internals: Allowed zero-length argument value - Internals: Allowed zero-length argument-to-argument-value separator - Security Fix

  • PDO_CUBRID 9.3.0.0002 1) Update cci to 9.3.0.0206

SitePoint PHP Blog: The PHP 7 Revolution: Return Types and Removed Artifacts

Mon, 01/19/2015 - 19:12

On the SitePoint PHP blog today Bruno Skvorc has written about the PHP 7 revolution and some of the changes coming with this next major version of the language (including return types and the removal of some functionality).

With the planned date for PHP 7's release rapidly approaching, the internals group is hard at work trying to fix our beloved language as much as possible by both removing artifacts and adding some long desired features. There are many RFCs we could study and discuss, but in this post, I'd like to focus on three that grabbed my attention.

He touches on a few topics in the post including:

  • the debate that came up about PHP 5.7 versus PHP 7
  • The addition of return types from functions/methods
  • The removal of PHP4 style constructors
  • Changes to the extension API

Obviously, since PHP7 is no where near release status, all or some of these things could be subject to change. For example, the removal of PHP4 constructors is still being hotly contested on the php.internals mailing list at the time of this post.

Link: http://www.sitepoint.com/php-7-revolution-return-types-removed-artifacts/

Joe Watkins: Mocking PHP

Mon, 01/19/2015 - 18:23

In his latest post Joe Watkins talks about mocking PHP. No, not making fun of the language but rather mocking internal PHP functions and methods as a part of unit testing your application.

I work on a vast PHP code base, it is 3M LOC of PHP alone. It's somewhere between legacy and modern, work is ongoing. [...] When I joined the current project there were many many tests, they relied upon the kind of unholy magic that runkit allows you to perform, for the most part this worked okay for a while. However, runkit inexplicably caused many of the tests to fault, either at shutdown, or at random.

[...] So we were in a bit of a jam, I've always found runkit to be quite awkward, and now I'm staring its source code in the face knowing it represents a road block to my goal of running the latest stable versions of PHP, with the first decent optimizer that ever existed for Zend. I tackled the problem with code, code which I was allowed by my gracious employer to open source (the uopz extension).

He goes on to talk about what the actual root problem he was trying to solve was (dodging code with built-in functions), the "obvious" way to solve it using runkit or the more modern solution that uses the uopz extension. He provides an example of it in use mocking the fopen function with a "uopz_function" wrapper.

Link: http://blog.krakjoe.ninja/2015/01/mocking-php.html

NetTuts.com: Building With the Twitter API: Repeating Tweets From a Group

Mon, 01/19/2015 - 17:18

NetTuts.com has continued their series about constructing a Twitter application as a Yii framework-based application. In this latest tutorial they expand on the previous post's "tweet storm" functionality and instead posts random updates based on pre-defined content. If you need to catch up, you can find the other parts of the series here.

The nature of the Twitter stream makes repetition useful, within reason; overdoing it is spammy and annoying.[...] This automates the task of repeating and creating variation over time to increase the likelihood that your Twitter followers will engage with your content. Keep in mind that the Twitter API has limits on repetitive content. You'll be more successful if you offer a wide variety of variations and run the service on an account that you also use manually to share other content.

They start with a short list of features the application needs to support including the main goal of posting the randomized, recurring tweets. They start by creating the Group model and table to allow for the grouping of tweets. Then they use Yii's scaffolding to create a form for creating new groups. Next up is the controller code to handle the group submission and an update to link a tweet to a group. Finally they include the code to push the tweets out to Twitter and mark the tweets as sent. The post ends with an example of a timeline with the resulting posts.

Link: http://code.tutsplus.com/tutorials/building-with-the-twitter-api-repeating-tweets-from-a-group--cms-22490

Matt Stauffer: Upgrading from Laravel 4 to Laravel 5

Mon, 01/19/2015 - 16:37

Matt Stauffer has posted a guide to his site to help you migrate from Laravel 4 to Laravel 5 as painlessly as possible. This is part fourteen in his overall introduction to Laravel 5 series of posts.

It's very simple to get started in a new Laravel 5 app [...] but what if you have a Laravel 4 app you want to upgrade? You might think the answer is to upgrade the Composer dependencies and then manually make the changes. Quite a few folks have created walkthroughs for that process, and it's possible-but there are a lot of little pieces you need to catch, and Taylor has said publicly that he thinks the better process is actually to start from scratch and copy your code in. So, that's what we're going to be doing.

He walks you through cloning a new Laravel 5 instance and setting up the various pieces of the application including the app itself, the domain folder and Composer dependencies. He then gets into the migration of things in the "app/" folder like controllers, database migrations and models. He also includes steps to update namespacing, handling the configuration updates, moving over user handling and any forms you may have created.

Link: http://mattstauffer.co/blog/upgrading-from-laravel-4-to-laravel-5