2013年9月24日星期二

Community News: Latest PECL Releases for 09.24.2013

Latest PECL Releases:

Community News: Packagist Latest Releases for 09.24.2013

Recent releases from the Packagist:

Derick Rethans: ISO 8601 week dates


Derick Rethans has a new post with details about handling ISO 8601 dates in PHP via the DateTime functionality. It's a response to some bugs filed having to do with week numbering.



Week numbers are defined in this same ISO 8601 standard. Each year has 52 or 53 weeks and weeks always start on a Monday. Week number 1 of each year is the first week in a year that has the first Thursday of the year, or in other words, the week containing January 4th.


He talks about some of the date format arguments that use would use when working with the ISO 8601 formatting and how it relates to the calendar year. He points out that the "Y" format specifier is not the same as the "o" - the first being the calendar year while the second relates to the ISO 8601 year.



As conclusion, this article shows that there are two ways representing dates in PHP. In the Gregorian1 calendar with year, month and day (of month), and in the ISO 8601 calendar with year, week and day (of week). The format characters for the two different years are either Y or o and they should not be confused.

Link: http://derickrethans.nl/iso-8601-weeks.html

Ulf Wendel: PHP Unconference Hamburg 2013: hungry for more


For those that weren't able to attend this year's PHP Unconference Hamburg Ulf Wendel has posted a great summary of the event including several photos.



I am a huge fan of the PHP Unconference. Ever since the first edition the who-is-who of the national PHP community gathers at this family style event. Very few events made it into this league from the start. Having a big name or being a sponsor, however, does not mean you make it on the session table as its the people that vote for sessions every morning. Only topics that really matter to the audience have a chance to make it.


He talks about the quality of the sessions themselves as well as some of the conversations in the in-between times (longer breaks to help make them possible). He also mentions some of the "not so goods" about the event like the scarcity of tickets, the lack of feedback on the sessions and the high marks it took to even make it as a speaker at the event. He links to some of the sponsors for this year's event and puts a request out for help with next year's event


Link: http://blog.ulf-wendel.de/2013/php-unconference-hamburg-2013-hungry-for-more

Gonzalo Ayuso: Sending automated emails with PHP, Swiftmailer and Twig


Gonzalo Ayuso has posted a new tutorial today showing you how to combine PHP, Swiftmailer and Twig to send automated emails from your application.



My work as host is basically pick the place and encourage people to join to the Coding Dojo. One way of doing this (besides twitter buzz) is take my address book and send one bulk email to all of them inviting to join us. I don't like this kind of mails. They look like spam, so I prefer to send a personalized email. This email has a common part (the place location, the hour, the event description, …) and the personalized part. I can do it manually, the list isn't so huge, but definitely that's not cool. Because of that I have done a little script to perform this operation.


His example extracts the information from a simple spreadsheet exported as a CSV file. He creates a simple Mailer class that uses Swiftmailer to do the actual sending. You pass in the Twig rendering object (Twig_Environment) that's used to render the email output. He includes a "Spammer" class that uses the Symfony EventDispatcher to send the email if everything works or an error email if something fails. He then drops it all into a Symfony Console command structure, defines several configuration settings in a "config.yml" and makes the script to execute the commands.


Link: http://gonzalo123.com/2013/09/23/sending-automated-emails-with-php-swiftmailer-and-twig

SoftLayer Blog: Four Rules for Better Code Documentation


On the SoftLayer blog today there's a new post with some recommendations for better code documentation - four tips to help make things clearer and cleaner.



Last month, Jeremy shared some valuable information regarding technical debt on SLDN. In his post, he discussed how omitting pertinent information when you're developing for a project can cause more work to build up in the future. One of the most common areas developers overlook when it comes to technical debt is documentation. This oversight comes in two forms: A complete omission of any documentation and inadequate information when documentation does exist. Simply documenting the functionality of your code is a great start, but the best way to close the information gap and avoid technical debt that stems from documentation (or lack thereof) is to follow four simple rules.

Their four recommendations cover several aspects of documentation:



  • Know Your Audience
  • Be Consistent - Terminology
  • Forget What You Know About Your Code … But Only Temporarily
  • Peer Review


They've also provided some examples of what they're talking about with PHPDocumentor-formatted comments.


Link: http://blog.softlayer.com/2013/four-rules-for-better-code-documentation