2014年3月31日星期一

Community News: Latest PEAR Releases for 03.31.2014

Latest PEAR Releases:

Community News: Packagist Latest Releases for 03.31.2014

Recent releases from the Packagist:

SitePoint PHP Blog: Image Scraping with Symfony's DomCrawler


On the SitePoint PHP blog today there's a new post showing you how to use the Symfony DomCrawler component to scrape content, images mostly, from a remote website. The DomCrawler is one component of the Symfony framework.



A photographer friend of mine implored me to find and download images of picture frames from the internet. I eventually landed on a web page that had a number of them available for free but there was a problem: a link to download all the images together wasn't present. I didn't want to go through the stress of downloading the images individually, so I wrote this PHP class to find, download and zip all images found on the website.


He talks briefly about how the class works and then gets into the contents of the class. He walks through all the code and explains in chunks what each part does in the lifecycle of the request. The end result is a Zip archive file of all images from the remote website, packaged up for easy transport.


Link: http://www.sitepoint.com/image-scraping-symfonys-domcrawler/

HHVM Blog: HHVM 3.0.0


The HHVM blog has an exciting new post for those using the HHVM and Hack language - they've officially released version 3.0.0 with complete Hack support.



At our last major version bump (2.0.0), we basically became a whole new project. We switched from a "PHP -> C++" translator to a virtual machine. This version bump (3.0.0) is a much less dramatic code shift (we're still a VM, don't worry), but this time the big announcement is that we support a new language, Hack.


They take a step back in time and look at the changes since 2.0.0 in organization, technology and community involvement. From there, they get into "the business" of what's in this new release including:



  • The old webserver is gone. If you get something like Uncaught exception: no factory for server type "libevent", you need to switch to fastcgi.
  • We are moving from .hdf config files to .ini.
  • Our most requested extension, mysqli is now in. (there's currently a bug, but the fix will be in 3.0.1).


You can find out more about the HHVM on the project's main website.


Link: http://hhvm.com/blog/4349/hhvm-3-0-0

NetTuts.com: Test Code Coverage: From Myth to Reality


There's a good post over on the NetTuts.com site today talking about unit testing, the myths around code coverage and why it may not be as important as you think.



Most cubicle workplaces disappeared and programmers started loving their craft. With the advent of Agile techniques and the Software Craftsmanship movement, many new tools emerged to help the programmer and the process. TDD is slowly becoming the de facto way of writing code and the secrets of SCRUM or Kanban were revealed even to the programmers in the darkest corners of the cubicle world. Automated testing and test driven development (TDD) are some of the essential techniques Agile provided to us programmers. And a tool that comes with those methodologies is used to produce test code coverage, which is the topic of this article.


The article starts with a brief definition of code coverage and gets right into an example class, PHPUnit test and the results of a code coverage generation. They show both output options, the text-only output and the full HTML output with clickable links and visualization of the covered lines of code. There's also an example of generating the coverage inside an IDE (PHPStorm). The post finishes with a look at the myths of code coverage including: "100% covered is bug free" and that "gaming the system" is pretty easy.


Link: http://code.tutsplus.com/articles/test-code-coverage-from-myth-to-reality--cms-20442

Evert Pot: PHP 5.5.10 timezone handling changes


Evert Pot has a new post sharing some of the changes in DateTime handling that he's updated in the latest release in the PHP 5.5.x series.



PHP 5.5.10 got released a few weeks ago, and among other things, it added some new functionality related to timezone handling. In short, [subtracting from UTC] now works. Normally this would not be recommended, as you really should specify timezones based on their geographical location. This information is not always available though, so it's a welcome new feature.


Other changes include the removal of the automatic translation from "UTC" to "GMT" as well as errors being thrown when one of the "odd" timezones are used (he provides the list). Additionally, an update around timezone "guessing" has been added and the fallback that was in place has been removed.


Link: http://evertpot.com/php-5-5-10-timezone-changes/

2014年3月30日星期日

Community News: Packagist Latest Releases for 03.30.2014

Recent releases from the Packagist:

2014年3月29日星期六

Community News: Packagist Latest Releases for 03.29.2014

Recent releases from the Packagist:

2014年3月28日星期五

Site News: Popular Posts for the Week of 03.28.2014

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 03.28.2014

Recent releases from the Packagist:

Liip Blog: HHVM and New Relic


In this new post to the Liip blog Christian Stocker talks about how they use the popular application and server monitoring service New Relic with the HHVM (despite no official support).



As discussed in one of my last blog posts, we really like New Relic for performance metrics and use it a lot. Unfortunately there isn't an extension for HHVM (yet) and HHVM is becoming an important part in our setup. But - a big great coincidence - New Relic released an Agent SDK and with that, an example extension for HHVM and WordPress. That was a great start for me to get behind the whole thing.


He talks about writing a HHVM extension and includes an example of the implementation. Christian also talks about the challenges around profiling data and finding out where the requests "spend their time" in the execution. There's two solutions he suggests, but they each have their tradeoffs (a recompiled/patched version or a performance hit). He provides the extension they've built in this github repository.


Link: http://blog.liip.ch/archive/2014/03/27/hhvm-and-new-relic.html

Matthew Weier O'Phinney: Apigility: Using RPC with HAL


Matthew Weier O'Phinney has a new post sharing some of the details about using RPC and HAL in the Apigility API tool from Zend. HAL stands for "Hypermedia Access Language" and basically provides a way to define objects in an API and what they relate to.



A few days ago, we released our first beta of Apigility. We've started our documentation effort now, and one question has arisen a few times that I want to address: How can you use Hypermedia Application Language (HAL) in RPC services? Hypermedia Application Language is an IETF proposal for how to represent resources and their relations within APIs. Technically, it provides two mediatypes, application/hal+json and application/hal+xml; however, Apigility only provides the JSON variant.


He introduces some of the basics of HAL and includes an example of JSON output showing metadata about the current object such as a full link to the resource. He also includes an example of the "embedded" data, additional related data, other objects, with their own structure and links. He also briefly mentions what RPC is and how it works before getting into how to set up the endpoints in your Apigility API with the help of "ContentNegotiation" functionality.


Link: http://mwop.net/blog/2014-03-26-apigility-rpc-with-hal.html

Three Devs and a Maybe Podcast: Web Application Security - Part 2


The Three Devs and a Maybe podcast has release their latest episode today - Web Application Security - Part 2 (Episode #17).



This week we wrap-up the top ten security risks compiled by OWASP, with discussion on topics including CSRF (Cross Site Request Forgery) and Known Component Vulnerabilities. Also included this week is a brief introduction to Hack and are thoughts on the programming language Go.


If you missed the first part of the series, you can find part one here. You can listen to this latest show by downloading the mp3 or you can subscribe to their feed and get this and other episodes as they're released.


Link: http://threedevsandamaybe.com/posts/web-application-security-part-2/

Reddit.com: Can anyone suggest a php ecommerce solution that isn't terrible?


Over on Reddit.com there's a good discussion (with plenty of feedback) to a user looking for "a PHP ecommerce solution that isn't terrible" to replace their aging implementation.



I've been using Lemonstand V1 for a couple of years now, it's been really decent, though they're zoning it out to make way for V2. They're moving to a cloud hosted monthly cost, without a lot of core features from V1, which means my agency needs to find an alternative.
Obviously the one that stands out is Magento, but I've logged in and clicked around and looks so bad. [...] I have recently found "builtwith.com" which seems to show usage stats for different ecommerce systems, though I cannot seem to find anything very good on that list which looks reliable. The most promising thing I could find was called "Sylius" (http://sylius.org/) which looks fantastic, BUT, it's newish, and there are no docs, it's not being supported by a company, it's only being held up by the community. Can anyone suggest any other alternatives to look into?


The comments to the post range from suggestions of other solutions to attempts to reinforce ones already mentioned:



  • "I'd go with the biggest names in eCommerce for PHP. That will give you the most leverage. We run our own ecommerce software and when your missing a community, features, and market share, it will be a ruff battle selling customers on your solution who are aware of software like Magento."
  • "No, sorry. No joke. Every ecommerce solution I touched is terrible. And Magento is hell."
  • "Drupal with the Ubercart module is pretty nice."
  • "You have checked out OpenCart, haven't you?"
  • "WooCommerce has been pretty good if you're on WordPress. Actually similar to Magento."
  • "In my experience none stand above the rest and all have their drawbacks, especially when you just need to getting something slightly custom up and running. We most recently used CS Cart and it was not terrible."


Check out the post for more feedback and suggestions.


Link: http://www.reddit.com/r/PHP/comments/21flle/can_anyone_suggest_a_php_ecommerce_solution_that/

2014年3月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 03.27.2014

Recent releases from the Packagist: