2013年12月22日星期日

Community News: Packagist Latest Releases for 12.22.2013

Recent releases from the Packagist:

2013年12月21日星期六

Community News: Packagist Latest Releases for 12.21.2013

Recent releases from the Packagist:

2013年12月20日星期五

Site News: Popular Posts for the Week of 12.20.2013

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 12.20.2013

Recent releases from the Packagist:

Dutch Web Alliance: The definitive remote debug and unittest with PHPStorm guide: part 4


The Dutch Web Alliance has posted the fourth part of their series looking at remote debugging with PHPStorm. If you want to start from the beginning, you can find the first part of the series here (along with a table of contents for the other parts).



Unit testing should play a pretty big part in your daily PHP work. With the help of PHPUnit, writing and executing those tests is fairly simple. But in a remote environment we run into some issues which we try to solve in this blogpost. I'm not going to tell you the basics of unit-testing, as we assume you already are familiar with this. If not, There are lots of blog posts on this subject.


With some tests already in place, they show you how to get PHPStorm all set up and working. First they talk some about how the IDE makes its connection to the remote server via a "proxy" script. There's a few problems with this method, so they show a different approach using the "PHP on Server" configuration setting. They walk you through the setup of this feature (with screenshots) and how to "trick" it using a dummy phpunit.xml file.


Link: http://dutchweballiance.nl/techblog/the-definitive-remote-debug-and-unittest-with-phpstorm-guide-part-4/

Cal Evans: The PHP CachingIterator


In this new post to his site Cal Evans shares an interesting and seldom mentioned part of the SPL in PHP, the CachingIterator, and an interesting behavior he found with its use.



In the course of writing my next book, "Iterating PHP Iterators", I found something very interesting. I have a short chapter on the CachingIterator. One of the flags in the CachingIterator is FULL_CACHE. It was during my experiments with that, that I found…an anomaly.


He includes a snippet of code showing the behavior that does work, just not exactly as expected. He found that to have the values correctly cached, he had to loop through the entire iterator before trying to use it. He also answers the "just rewind() the iterator" comments with another code snippet showing it with the same behavior as before. His final example is one that does work as expected, unsetting the correct index and replacing the value as requested.



So today I learned, don't use the FULL_CACHE flag on the CachingIterator. I am not sure what the FULL_CACHE flag is supposed to do, but it doesn't seem to do anything useful at the moment. Also, it can screw things up for you.

Link: http://blog.calevans.com/2013/12/19/the-php-cachingiterator/

Alex Bilbie: Using Vagrant and Ansible for distributing educational course virtual machines


in his latest post Alex Bilbie shares a guide for the steps he follows to create virtual machines for an educational course using Vagrant and Ansible with a PHP+Apache environment set up and ready to go.



In "Cursory Thoughts on Virtual Machines in Distance Education Courses" Tony discuses using virtual machines in courses to help distribute software and operating systems to students who increasingly more and more are bringing in very different devices. [...] At the very end of the article Tony mentions using Vagrant which is a small piece of software to help "create and configure lightweight, reproducible, and portable development environments". [...] A better option [for managing VM deployment] would be to use another devops tool called Ansible which "is a powerful automation engine that makes systems and apps simple to deploy".


He includes both a sample Vagrantfile for configuring Vagrant and a YAML configuration for Ansible that sets up the VM, opens the needed ports and installs and configures the needed software.



Together the playbooks and the Vagrantfile can be distributed to the students and assuming they've installed Vagrant and Virtualbox for their OS they can be up and running with identical environments in just a few minutes.

Link: http://alexbilbie.com/2013/12/vagrant-ansible-courses/