2014年2月28日星期五

Site News: Popular Posts for the Week of 02.28.2014

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 02.28.2014

Recent releases from the Packagist:

LeaseWebLabs.com: Lessons learned implementing AES in PHP using Mcrypt


The LeaseWebLabs.com site has a new post talking about some of their difficulties (and lessons learned) when implementing AES in PHP with mcrypt for a recent project.



The Advanced Encryption Standard (AES) is the successor of triple DES. When you need a standardized, secure, high performance symmetric cipher it seems like a good choice. Wi-Fi network traffic is encrypted with AES for instance. Also when you want to securely store data in a database or on disk you could choose AES. Many SSDs store data internally using AES encryption. PHP supports AES through "mcrypt". On Debian based systems (like Ubuntu and Mint) you can install it using "sudo apt-get install php5-mcrypt".


With no direct support for AES in mcrypt, they decided on Rijndael-128 instead and include some code examples of getting its key and block size. They also include an example of the dynamic typing PHP does when converting a string to an integer and the "key padding" PHP automatically does if the key length it too short. A few other problems they discovered during implementation are mentioned as well including null padding on strings and PHP's ignoring of a wrong size initialization vector (no padding, just an error).


Link: http://www.leaseweblabs.com/2014/02/aes-php-mcrypt-key-padding/

Mastering Zend Framework: Gary Hockin's Maximising Zend Framework 2 Performance Talk (Review)


From the Master Zend Framework blog there's a new post reviewing a talk from this year's PHPUK (2014) from Gary Hockin, "Maximising Zend Framework 2 Performance".



Whether you're new to Zend Framework 2, or an old hand (can someone really say they're an old hand after such a short period of time?) the talk covered a range of tools, tips, and techniques for increasing application performance. This wasn't an academic run through; it was a talk based on practical, hands-on, experience from Gary's time as a core ZF2 contributor, and his work at Roave, Yamgo and AdSpruce.


The post talks some about the tools Gary used to benchmark his improvements and some common metrics to be aware of in your own results. Xdebug and Xhprof were also recommended for more introspection into what the application is doing and where the bottlenecks lie.


Link: http://www.masterzendframework.com/reviews/maximising-zend-framework-2-performance-phpuk14

SitePoint PHP Blog: Debugging with Xdebug and Sublime Text 3


The latest post from the SitePoint PHP blog, a new tutorial by Peter Nijssen, shows you how to get started with Xdebug and Sublime Text 3 to debug your PHP applications.



Debugging - we all do it a lot. Writing code perfectly the first time around is hard and only a few (if any) succeed at it. More than a year ago, Shameer wrote an article on SitePoint about how you can debug your application using Xdebug and Netbeans. In this article, we are going to have a look at how we can debug using Xdebug in combination with Sublime Text.


He assumes you already have Xdebug installed (and links to the instructions for those that don't) and helps you configure it to find your listening editor. Back in Sublime, he shows you how to use the package manager to install the Xdebug client and configure the current project to use it. He shows how to set up breakpoints and view the stack/watch data when the point is hit.


Link: http://www.sitepoint.com/debugging-xdebug-sublime-text-3/

2014年2月27日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Community News: Packagist Latest Releases for 02.27.2014

Recent releases from the Packagist:

Paul Jones: Leanpub Sample Files With Symfony and Aura


In a recent post to his site Paul Jones shares some work that's been done to help generate books in the Leanpub formatting with an Aura framework-based script.



One of the things that bothers me about some cli/console packages is how the commands you write with them end up being tightly coupled to the "framework" the package provides. [...] Most of the time I don't need a "full console application" - I just need to read some input for the command, run my actual command logic, and send some output from the command. The Leanpub Sampler from Matthias Noback is an example of the kind of thing I usually end up doing in small or one-off projects.


The script makes use of the Aura.Cli component for console interaction then a custom object for the actual work. This completely decouples the CLI handling from the code to produce the resulting document. You can find out more about the Aura framework on the project's main site.


Link: http://paul-m-jones.com/archives/5921

IT World: Does relying on an IDE for development make you a bad programmer?


On the IT World site there's an interesting post that poses the question - does relying too heavily on your IDE make you a bad programmer?



The truth is that a good IDE makes you vastly more productive than a bad one or none at all. Projects are off the ground faster thanks to helpful scaffolding. Coding moves faster thanks to intelligent autocompletes and IDE refactoring tools. Integrated unit testing helps your application be more maintainable. Built in deployment tools, web servers, code analysis, and compile time bundling streamlines the workflow. It also standardizes the developer experience which benefits both the programmer and the business.


He mentions the original post that got him thinking about the topic. It talks about the reliance one developer feels like they now have on their IDE. They feel that it's "made them lazy" in their development practices. The article isn't specifically focused around PHP as there are IDEs for other languages that do a lot more for work for you. There are some in the PHP world, like PHPStorm that do rank up there as far as automated features, though.


Link: http://www.itworld.com/development/406451/does-relying-ide-development-make-you-bad-programmer

HHVM Blog: Implementing MySQLi


On the HHVM blog today a new post talks about some of the work they've been doing to introduce one of the common PHP extensions, MySQLi, into the HHVM system. The post walks you through some of the process the author followed to work up the implementation.



To prepare for what was to be my big project, I rewrote the ini parser to better match Zend. [...] After warming up with the parser, I was ready to start my big project: implement MySQLi. This has been a long requested feature for HHVM. And, this extension is required to help meet our compatibility goals.


He walks you through some of the preparation steps for the work integrating the extension and the tools used for these initial steps. He briefly steps through the actual implementation and the testing of the feature (and some changes made to allow the tests to run faster). He mentions a few roadblocks hit along the way, the current status of the effort (182 passing tests, 114 failing) and some of the missing pieces yet to be worked.


Link: http://www.hhvm.com/blog/3689/implementing-mysqli

2014年2月26日星期三

Community News: Recent posts from PHP Quickfix

Recent posts from the PHP Quickfix site:

Community News: Packagist Latest Releases for 02.26.2014

Recent releases from the Packagist:

Voices of the ElePHPant: Interview #1 with Larry Garfield : Drupal 8 & PHP 5.4


The Voices of the ElePHPant podcast has released their latest episode interviewing a member of the PHP community. This time Cal Evans talks with Larry Garfield about Drupal 8 and PHP 5.4.



This is part one of the interview and they talk about things like: Larry's company, Refactor: Chicago, the Chicago Advanced Drupal Users Group and a blog about traits.



You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you enjoy the interview, you should also consider subscribing to their feed.


Link: http://voicesoftheelephpant.com/2014/02/25/interview-1-with-larry-garfield-drupal-8-php-5-4/

Derick Rethans: DateTimeImmutable


In his latest post Derick Rethans (knower of all things date and time) talks about the DateTimeImmutable functionality. It has been added into the PHP 5.5 releases and provides the same DateTime functionality but removes the ability for modification (mutability).



The first time that my improved DateTime support made its way into PHP was officially in PHP 5.1, although the more advanced features such as the DateTime class only made it appearance in PHP 5.2. Since its introduction the DateTime class implementation suffered from one design mistake - arguably not something that even an RFC would have highlighted. [...] This mutability property that all modifying methods of the DateTime class have is highly annoying, and something that I would now rather remove. But of course we cannot as that would break backwards compatibility. So in PHP 5.5, after a few stumbles, I finally managed to rectify this.


He includes some code examples showing the current DateTime object's mutability (via the "modify" function) and the new immutable handling. This new handling doesn't update the current object but instead returns the modified object, leaving the initial one intact. You can find out more about this new object in the PHP manual.


Link: http://derickrethans.nl/immutable-datetime.html

HHVM Blog: HHVM: The Next Six Months


In their latest post the HHVM project (of Facebook) has laid out the next six months ahead for the development and progression on the project. In it they talk some about their "themes" and overall Open Source goals planned for the first part of 2014.




The HHVM team has just wrapped up its planning for the first half of 2014. We'd like to share our plans, providing you a bit of context. We've been making steady progress on HHVM's compatibility with PHP in the wild, but we still have a lot of work ahead of us. We're using unit test pass rates as a proxy for success measurement, but you can help by adding HHVM to your Travis configuration, and reporting bugs and issues through GitHub. We are resourced to help support a couple of major HHVM deployments, which we hope has the side effect of exposing us to "non-Facebook" deployment and maintenance challenges.



We are also going to push for a more open development model, with the goal of increasing our community participation. We'll have more to say on what this means later on. Stay tuned!




They also cover some of the work being done to increase the overall efficiency, reducing CPU time and memory consumption. There's also mention of work being done on a guide to "hacking" in the HHVM, reducing some complexity in the compiler and the conversion to a full HNI extension interface.


Link: http://www.hhvm.com/blog/3743/hhvm-the-next-six-months

2014年2月25日星期二

Community News: Latest PECL Releases for 02.25.2014

Latest PECL Releases:
  • jsonc 1.3.4
    - Fixed bug #65753 JsonSerializeable couldn't implement on module extension


  • yp 1.0.0RC1
    Initial beta release

    - Fix build with modern PHP including PHP 5.3, 5.4 and 5.5 [gasolwu]
    - Build testing environment with vagrants [gasolwu]
    - Add tests for all public funcctions [gasolwu]


  • apn 1.0.3
    - Fixed typo in constant name (APN_PODUCTION -> APN_PRODUCTION)
    - Incorrect warning message in apn_feedback()
    - Added "invalid token" warning in apn_send()
    - TSRM fixes


Community News: Packagist Latest Releases for 02.25.2014

Recent releases from the Packagist:

PHP Town Hall Podcast: Episode 19: Episode 19: Jeffrey Way, Laracasts and BDFLs


The PHP Town Hall podcast has released their latest episode today - Episode #19 with special guest Jeffrey Way of the Laravel community.



Well known PHP/Laravel nice-guy Jeffrey Way from NetTuts and Laracasts joins regular guest Zack Kitzmiller to discuss the wonderful world of Laravel once again. This time the discussion focuses on some of the silly complaints people have with an otherwise wonderful system, and on the reusability of its packages.


You can catch this latest episode a few different ways: either listening to the audio through the in-page player, by downloading the mp3 or you can watch the live video of the recording.


Link: http://phptownhall.com/blog/2014/02/15/episode-19-jeffrey-laracasts-bdfls/

VG Tech: Swagger Docs in ZF2 with Examples - Part 1: Setup and Annotations


The VG Tech blog has posted the first part of a series they're doing about Zend Framework 2 and Swagger, the auto-generating documentation project for APIs. In this first part of the series, they go through some setup and show the use of annotations to define the Swagger output.



So everyone is building APIs now - parsing and outputting JSON is not that hard. Some people even build truly RESTful APIs, or something not to far from that. Before, when building APIs was about SOAP with XML schemas and WSDL specifications, people spent so much time building their APIs that they had the time to think. Now, building an API is so easy and fast that the documentation is often suffering. [...] Swagger is a popular project providing auto generated API docs based on a service specification. This spec is based on annotation comments in the controllers and models, giving the developer a fairly easy, and close to the code way of keeping the API docs up to date.


He walks you through the process to clone and setup the Zend Framework 2 project first, then pull in the "outeredge/swagger-module" with Composer. This package provides the tools to generate Swagger output from annotations in the PHP code. He also shows you how to set up the Swagger UI project (wordnik/swagger-ui). Finally, he gets into the code examples, showing how to annotate models and use partials.


Link: http://tech.vg.no/2014/02/24/swagger-docs-in-zf2-with-examples-part-1-setup-and-annotations/