2013年4月29日星期一

Community News: Latest PEAR Releases for 04.29.2013

Latest PEAR Releases:

Community News: Packagist Latest Releases for 04.29.2013

Recent releases from the Packagist:

7PHP.com: Interview with Jakub Vrana - Co-Author Of The Official PHP Manual


7PHP.com has another community interview posted today - this time it's with Jakub Vrana, a co-author that works on the official PHP manual.



In this edition I talked with Jakub Vrana who is a co-author of The Official PHP Manual. @jakubvrana is also the creator of the two successful projects namely Adminer and NotORM. I invite you to know him better and to learn from his 7php PHP interview.


The interview shares Jakub's answers about things like:



  • His history as a PHP developer
  • What he sees as good and bad parts of it
  • His preferred tools
  • His choices on frameworks and ORMs
  • How to get started contributing to the documentation/manual
  • Some about his book "1001 tips and tricks for PHP"

Link: http://7php.com/php-interview-jakub-vrana

Reddit.com: How to progress my PHP skills?


On Reddit.com a reader has asked the community what they think he needs to do to progress his PHP skills past the "little bit" he's learned so far.



Last summer I started learning a little bit of PHP, knowing HTML and CSS drove me towards wanting to learn some PHP for fun. I went through a pretty simple book, and made some simple websites (registration and message system, user submitted data, file uploads) using mostly tutorials which I tweaked a little bit. Since last summer I haven't learned anything new, but now that summer is coming along again I might be a bit bored, so I have been thinking of attempting to learn even more.

Suggestions included in the comments are things like:



  • Learn about software architecture.
  • Understand your environment.
  • I very highly suggest learning a PHP framework.
  • http://www.phptherightway.com
  • Start learning industry tools for PHP. It will all influence your coding style, and illustrate why some styles are considered best practices.
  • To add to the other suggestions, I recommend becoming a regular contributor to one or more open source projects.
  • What helped me a lot was to write my own micro framework using OOP that I can now use for future websites and web applications.
  • Come up with a 'complex' web site/application idea and get to it. Bonus points if you can launch it and make money off it (half kidding).


You can read the full set of comments for more good suggestions here.


Link: http://www.reddit.com/r/PHP/comments/1d32dr/how_to_progress_my_php_skills

Elijah Horton: Sandboxing Untrusted Code With PHPSandbox


Elijah Horton has a recent post to his site sharing a tool he's developed to sandbox and validate PHP code of user-contributed code.



Few quotes related to the PHP language are as pithy and resoundingly accurate as the phrase: "Eval is evil." The reasons are myriad: the eval() function basically gives whatever code is passed to it unlimited control of the parser, and this freedom makes eval() both a temptation for developers, who may need to dynamically control PHP at runtime, and a panacea for hackers who are ever-searching for more servers to add to their botnets. So, how does one make use of the extreme power available through runtime evaulation of PHP, without exposing one's server to near-certain rooting? Through a sandbox.


His tool - PHPSandbox, uses the PHP-Parser library to deconstruct the PHP code its given and look for issues. He gives an example of a call to mail and how it would catch the issue. He shows how to install it via Composer, how to configure it with whitelisted methods/functions. It also includes a way to overwrite function calls with a bit safer alternative.


Link: http://www.fieryprophet.com/blog/detail/sandboxing-untrusted-code-with-phpsandbox

2013年4月28日星期日

Community News: Packagist Latest Releases for 04.28.2013

Recent releases from the Packagist:

2013年4月27日星期六

Community News: Packagist Latest Releases for 04.27.2013

Recent releases from the Packagist:

2013年4月26日星期五

Site News: Popular Posts for the Week of 04.26.2013

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 04.26.2013

Recent releases from the Packagist:

Software Gunslinger: PHP is meant to die, continued


In his previous post ("PHP was meant to die") the point was made that PHP isn't really designed as a language to handle long running processes very well. It's made to handle a few operations and then die at the end of the request. In this follow up post he talks more about using PHP for long running processes and a library that could help.



Yes, I already acknowledged that PHP has a garbage collection implementation starting 5.3.0 and up (opt-in or opt-out, that's not the problem). I also acknowledge that garbage collection works, and is able to take care of most circular references just fine. [...] Anyway, as previously stated too, garbage collection is a great thing, but not enough for PHP. It's a borrowed feature that does not play well with old fundamental decisions inherited from the original design. Garbage collection is not a magical solution for every problem, like many tried to argue about. Let's illustrate with another example.


His example uses the React PHP library (a non-blocking I/O platform) to handle a lot of incoming data to a port and report back some memory usage and limit settings. He explains a bit about what's happening and shares the results of the test, including the end result - a fatal error when the memory limit was hit. He still comes to the same conclusion, ultimately...PHP is just not the language to use for long-running processes that do any large amount of work.


Link: http://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued

/Dev/Hell Podcast: Episode 31: Feline Tooth Extraction


The /Dev/Hell podcast has posted their latest episode - Episode #31 - Feline Tooth Extraction. The podcast is hosted by PHP community members Chris Hartjes and Ed Finkler.



Short notes time: In this episode, Chris and Ed talk about conferences we always wanted to go to, and languages & tools we'd thought we'd hate and turned out to like. Then Ed waxes on the Open Recipes project.


You can listen to this latest episode either through the in-page player or by downloading the mp3. Links to all of the technologies and tools they mention are in the show's notes on the page.


Link: http://devhell.info/post/2013-04-24/feline-tooth-extraction

PHPMaster.com: Better Understanding Random


On PHPMaster.com there's a new tutorial talking about randomness in PHP, what it is and some of the things it can be used for.



Use of random values is very important in the computer security field. It is crucial in computer programming for development of secure systems that are not vulnerable to malicious subversion. Cryptography relies on random value's generation and their reproducibility for unpredictable output that is core for security of any system. Random values are fundamental for secure coding practices and PHP highly makes use of them for security. You will find them used in all libraries and frameworks and almost all codes rely on them for the generation of tokens, salts and as inputs for further functions.


He talks about the important of good random numbers and some of the common uses for it including generating salts and unique identifiers. He mentions the "pseudorandomness" of PHP's generators and how they're seeded to help increase this randomness. He finishes up the tutorial with some suggestions and language features for creating "as random as possible" values like using "/dev/urandom" on Linux-based systems.


Link: http://phpmaster.com/better-understanding-random

2013年4月25日星期四

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 04.25.2013

Recent releases from the Packagist:

PHP.net: PHP 5.5 beta 4 is now available


The PHP.net site has posted about the release of PHP 5.5 beta 4, the last beta that will be made for this series.



The PHP development team announces the release of the 4th beta of PHP 5.5.0. This release fixes some bugs against beta 3 and cleans up some features. This is a development preview - do not use it in production.


Several bugs were fixed and changes made - you can read the complete list in the NEWS file. To get this latest beta and try it out with your applications (and run the tests) you can download it here (here for Windows).


Link: http://php.net/index.php#id2013-04-25-1

Rob Allen: Simple logging of ZF2 exceptions


In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.



I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.


He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.


Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions

Luis Atencio: Notes on Continuous Delivery - Implementing a Testing Strategy


Luis Atencio has posted the latest article in his "Continuous Delivery" series today, this time with a focus on implementing a testing strategy. This is the fourth post in the series (part 1, part 2 and part 3).



There are three things in life that are always held to be true: we will die someday; we will pay taxes; and software will have bugs.... LOL [...] A testing strategy is often overlooked in software projects. This should not be too surprising, we want to build applications quickly and release them quickly. However, leaving quality out of the picture or towards the end are terrible mistakes.


He talks some about the different types of testing that revolve around software development - "business facing" and "technology facing." These are each split down even further into things like acceptance, integration and unit testing.


Link: http://www.luisatencio.net/2013/04/notes-on-continuous-delivery.html

2013年4月22日星期一

Community News: Latest PEAR Releases for 04.22.2013

Latest PEAR Releases:

Community News: Packagist Latest Releases for 04.22.2013

Recent releases from the Packagist:

PHP Town Hall Podcast: Episode #6 - PSR-X and the Mexican Standoff


The PHP Town Hall podcast has released the latest episode of their show - Episode #6, "PSR-X and the Mexican Standoff".



PHP-FIG member Paul M. Jones and PHP contributor Anthony Ferrera come on the podcast with Ben, Phil and regular guest Zack Kitzmiller to discuss the new Package Orientated Autoloader Proposal (a.k.a PSR-X), and wether or not PSR's should ever be amended.[...] Nobody wins, but the argument brings up a lot of interesting topics and points of view, and that is mostly what we are here for.


You can listen to this latest episode either through the in-page player by downloading the mp3 or by subscribing to their feed. The post also contains links to several of the groups and technologies mentioned in the episode.


Link: http://phptownhall.com/blog/2013/04/19/episode-6-psr-x-and-the-mexican-standoff

DZone.com: Trying out PHP Refactoring Browser


On DZone.com Giorgio Sironi has written up a post about some testing he's done with the ""PHP Refactoring Browser" (more on that here) on some basic code examples.



IDE proponents love, in fact, an Integrated Development Environment that provides all the functionalities you need while writing and editing code; the followers of the Unix way typically write code in Vim while augmenting it via plugins where feasible and leveraging external tools that do one thing, and do it well. [...] Automated refactorings in PHP were out of the league of Vim and Unix users; thanks to Qafoo, however, a new open source tool is able to edit code with predefined refactoring recipes: PHP Refactoring Browser.


He goes through some of the basic features and functionality of the browser, setting expectations a bit. He shows how to get it installed (via Composer) and the results of some of his testing. Rather than including them all in the post, he opted to make actual commits on github of the changes.


Link: http://css.dzone.com/articles/trying-out-php-refactoring

PHPMaster.com: Consuming Feeds with SimplePie


In a recent post to PHPMaster.com Kevin Mowry shows you how to use SimplePie, a simple to use programatic feed reader you can use to parse things like RSS feeds.



If you're an avid feed consumer like I am, you might be a bit sad to see Google's recent announcement of Reader reaching end of life. Reader was simple and easy to use, but there's no reason you can't have the same functionality with your own homegrown project. The PHP library SimplePie allows for quick and easy feed consumption and display. Here's how you can get started on your own feed reader.


He helps you get it installed (via Composer) and shows you how to use some of its most basic functionality to parse the New York Times' feed. He also includes examples of getting the information back out of the SimplePie object. There's also some snippets that show how to only get the latest items and how to cache the results.


Link: http://phpmaster.com/consuming-feeds-with-simplepie

7PHP.com: Zend Certifications Tips & Tricks - Hear It From Zend Certified Engineer Eric Hogue


On 7PHP.com there's a new post that interviews a PHP community member, Eric Hogue, about his experience with the Zend Certified Engineer exam.



This is the 3rd set of Zend Certification Tips and Advice to help anyone taking either of the two Zend Exams powered by Zend Technologies: the Zend PHP Certification Exam and/or the Zend Framework Certification Exam. The aim being to help people who want to sit for those exams and inform them what it is all about & what to expect by hearing it from (pro) PHP Guys who have already been through it, that is => Hear It From Zend Certified Engineers!


He starts off with some general questions to Eric about the exam and its structure and how he prepared himself for it. He mentions some of the resources he used to study and what kind of topics to pay attention to. There's also a few quotes included at the end giving another perspective on the exam (specifically, some frustrations).


Link: http://7php.com/zend-certification-advice-eric-hogue

2013年4月21日星期日

Community News: Packagist Latest Releases for 04.21.2013

Recent releases from the Packagist:

2013年4月19日星期五

Site News: Popular Posts for the Week of 04.19.2013

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 04.19.2013

Recent releases from the Packagist:

DZone.com: PHPUnit vs. Phake cheatsheet


On DZone.com today Giorgio Sironi has posted a "cheat sheet" to help you correlate the functionality of two PHP unit testing tools - PHPUnit vs Phake (for mocking objects).



Benjamin Eberlei introduced me to Phake with his recent article: it is a Composer-ready PHP library that integrates easily with PHPUnit and provides an independent Test Doubles framework, capable of producing Stubs, Mocks, and Spies. The syntax and object model reminds me of Mockito, the Java Test Double framework from the authors of Growing Object-Oriented Software. I like tools that do one thing and do it well, and after experimenting with Phake I'm using it on all new code.


He compares the two tools on a few different pieces of functionality including creating stubs, mocks and spies. Sample code is included for both sides. It's not a detailed guide by any means, but it can give you a better picture of how the two compare.


Link: http://css.dzone.com/articles/phpunit-vs-phake-cheatsheet

NetTuts.com: Reflection in PHP


On NetTuts.com today there's a new tutorial talking about a part of PHP that can be quite powerful but isn't used too often - reflection in PHP. Using Reflection you can get information about your actual code and its elements without having to try to parse it yourself.



Reflection is generally defined as a program's ability to inspect itself and modify its logic at execution time. In less technical terms, reflection is asking an object to tell you about its properties and methods, and altering those members (even private ones). In this lesson, we'll dig into how this is accomplished, and when it might prove useful.


They provide a little context around the idea of "reflection" in programming languages and then jump right in with a few sample classes. They set up their "Nettuts", "Manager" and "Editor" classes and show how to use the ReflectionClass functionality to get their structure. The examples show how to get the class' methods, their properties and calling these methods using things like invoke and call_user_func.


Link: http://net.tutsplus.com/tutorials/php/reflection-in-php

2013年4月18日星期四

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 04.18.2013

Recent releases from the Packagist:

Pixelstech.com: Should we use Abstract class or Interface?


On the Pixelstech.com site today there's a new post that talks about the differences between abstract classes and interfaces and when's the best time to use either (or both).



When we write programs, we may often get into a situation where we don't know whether we should use Abstract class or Interface when we want to define an abstract object. These two are very similar and they are interchangeable. On Stackoverflow, this question is asked many times, it's related to many programming languages. Also in the official documentation of PHP regarding the Abstract class and Interface, people are arguing about this. To understand this question, we need to understand their differences and use scenarios.


They provide examples of abstract class and interface usage with one of the main differences being that you can define functionality in abstract classes. There's also examples showing classes that extend the abstract class while implementing the interface at the same time, helping to define the object structure to an even finer level.


Link: http://www.pixelstech.net/article/1366044255_Should_we_use_Abstract_class_or_Interface_

Symfony Blog: Symfony Live Portland 2013: The Schedule has finally been published!


On the Symfony blog there's a new post about the Symfony Live Portland schedule being published:



We have finally selected all the great speakers that will share their experience with the Framework with you at Symfony Live Portland 2013. We had a very hard time choosing among all the excellent talks' proposals we received. After a long time of thinking, we are very pleased to publish the talks we think you most want to attend for this edition. For the first time in the USA, there will be 2 tracks per day; more than 20 talks are scheduled, a lightning talk session and the now famous Jeopardy session with the fantastic Jeremy Mikola! Let's say that it will be now your turn to have a hard time choosing among these great talks! Have a look now at the schedule and register to the conference!


They also mention the availability of the Symfony certification and that they're still looking for sponsors for this year's event. You can register now and pick up tickets for about $400 USD ($600 for the Combo pass).


Link: http://symfony.com/blog/symfony-live-portland-2013-the-schedule-has-finally-been-published

PHPMaster.com: Base Converting and Binary Operators


On PHPMaster.com there's a new tutorial from Timothy Boronczyk focusing on the binary operators in PHP and using them to do some base conversions.



This article discusses PHP's binary operators and how to convert between different counting systems. Most programming books and articles only dedicate a page or two to such topics, and although using the operators is really quite simple, there's a fair amount of background knowledge one must have to use them correctly. Instead of giving the same bare-bones treatment that every other reference gives, I'll first provide you the necessary background in number theory. Armed with that knowledge, you'll be able to understand the binary counting system and base conversions… and familiarity with binary digits is the key to successful use of the binary operators!


As promised he starts off with some number theory complete with illustrations about base-10 and how the values fit into "buckets" of data. He compares this to base-2 (binary) and only then starts getting into the conversion functions. He shows the usage of things like decbin and dechex to modify the values as well as the use of bitwise and binary operators.


Link: http://phpmaster.com/base-converting-and-binary-operators

2013年4月17日星期三

Community News: Latest Releases from PHPClasses.org

  • Page File

    Screen shot measuring with chrome tools approx difference is 6 msecs

    Package:


    Summary:

    Generate pages and save to files

    Groups:


    Author:


    Description:

    This class can Generate pages and save to files...



    Read more at http://www.phpclasses.org/package/8002-PHP-Generate-pages-and-save-to-files.html






  • PHP Collections Framework

    Package:


    Summary:

    Manipulate collections of objects like Java and C#

    Groups:


    Author:


    Description:

    This package can be used to manipulate collections of objects like Java and C#...



    Read more at http://www.phpclasses.org/package/8008-PHP-Manipulate-collections-of-objects-like-Java-and-C-.html






  • QdbQuery

    Package:


    Summary:

    Query MySQL databases using parameters

    Groups:


    Author:


    Description:

    This class can query MySQL databases using parameters...



    Read more at http://www.phpclasses.org/package/8011-PHP-Query-MySQL-databases-using-parameters.html






  • MySQL Database usage

    Package:


    Summary:

    Query MySQL database tables

    Groups:


    Author:


    Description:

    This class can query MySQL database tables...



    Read more at http://www.phpclasses.org/package/8009-PHP-Query-MySQL-database-tables.html






  • PHP Compare Objects

    Package:


    Summary:

    Compare objects using reflection

    Groups:


    Author:


    Description:

    This class can compare objects using reflection...



    Read more at http://www.phpclasses.org/package/8012-PHP-Compare-objects-using-reflection.html






  • PHP Curl Parallel Requests

    Package:


    Summary:

    Send multiple HTTP parallel requests with Curl

    Groups:


    Author:


    Description:

    This class can send multiple HTTP parallel requests with the Curl extension...



    Read more at http://www.phpclasses.org/package/8014-PHP-Send-multiple-HTTP-parallel-requests-with-Curl.html






  • wURI

    Package:


    Summary:

    Parse an URL and extract its parts

    Groups:


    Author:


    Description:

    This class can parse an URL and extract its parts...



    Read more at http://www.phpclasses.org/package/8005-PHP-Parse-an-URL-and-extract-its-parts.html






  • PHP Reduce JSON

    Package:


    Summary:

    Compress JSON data using the reduced JSON format

    Groups:


    Author:


    Description:

    This class can compress and decompress JSON data using the reduced JSON format...



    Read more at http://www.phpclasses.org/package/8007-PHP-Compress-JSON-data-using-the-reduced-JSON-format.html






  • File Reader

    Package:


    Summary:

    Read and search text files

    Groups:


    Author:


    Description:

    This class can read and search text files...



    Read more at http://www.phpclasses.org/package/8006-PHP-Read-and-search-text-files.html