2013年6月30日星期日

Community News: Packagist Latest Releases for 06.30.2013

Recent releases from the Packagist:

2013年6月29日星期六

Community News: Packagist Latest Releases for 06.29.2013

Recent releases from the Packagist:

2013年6月28日星期五

Site News: Popular Posts for the Week of 06.28.2013

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 06.28.2013

Recent releases from the Packagist:

PHP Town Hall Podcast: Episode 8 - Use Your Time Machine to Go to PeersConf Yesterday


The PHP Town Hall podcast has posted their latest episode - Episode #8, "Use Your Time Machine to Go to PeersConf Yesterday"



In this episode Ben and Phil talk to the super-talented conference organiser Jessica D'Amico, joined by avid conference goer and PHP rockstar Matt Frost. We all gab a bunch about conferences in general, specifically LaraCon, PeersConf and php|tek. We fucked up and didn't get this episode out soon enough to actually get her any sales for her latest conferences PeersConf (Phil is at PeersConf right now), but you should definitely follow Jess to see what conferences she puts on in the future, they're always great.


You can listen to this episode either through the in-page player or by downloading the mp3. You can also subscribe to their feed to get this and other new episodes as they're released.


Link: http://phptownhall.com/blog/2013/06/27/episode-8-use-your-time-machine-to-go-to-peersconf-yesterday

NetTuts.com: Diving Into Symfony 2


On NetTuts.com there's a recent tutorial posted that helps you "dive into Symfony2" and gives you an introduction to the framework including some code samples of a basic MVC structure.



Frameworks are hot topics in the web-industry and have been for some time. In this vast sea of flavors is Symfony - an extensive PHP framework that follows the ever popular MVC paradigm. Its learning curve is probably a little steeper than its fellow competitors, like CodeIgniter. Don't worry, once it grows on you, you'll feel more powerful than ever and you'll be able to develop fantastic applications.


They walk you through a few different things including the overall flow of a Symfony2 application and getting it installed (and where its files live). They show you how to use the console commands to generate parts of an application and creating controllers/routes/output via Twig as well.


Link: http://net.tutsplus.com/tutorials/php/diving-into-symfony-2-2

Amazon Web Services PHP Blog: Syncing Data with Amazon S3


On the Amazon AWS blog there's a recent post showing you how to sync data with S3 and handle multiple files quickly and easily.



Have you ever needed to upload an entire directory of files to Amazon S3 or download an Amazon S3 bucket to a local directory? With a recent release of the AWS SDK for PHP, this is now not only possible, but really simple.


He includes example code for doing it both ways - upload and download syncing - as well as some options you can use to customize the connection. You can define things like ACL settings, the number of concurrent connections and if you want the debug options turned off or on.


Link: http://blogs.aws.amazon.com/php/post/Tx2W9JAA7RXVOXA/Syncing-Data-with-Amazon-S3

PHPMaster.com: Running Monte Carlo Simulations in PHP


On PHPMaster.com there's a new tutorial by J Armando Jeronymo that shows how you can run Monte Carlo simulations in PHP (more on that simulation type here).



One of the exciting things in the 1980′s was programming simulations to solve complex analytical problems, and one of the most useful techniques employed was running Monte Carlo simulations. The approach repeatedly runs a simulation many times over to calculate the most likely outcome. Although PHP isn't known as a scientific or research programming language, Monte Carlo simulations can easily be written in a PHP web app. In this article, I'll show you how.


He walks you through the whole problem he tries to solve with the simulation - a multi-step trip that involved different roads, situations and possible stops along the way. He breaks it out into the various stages (labeled with letters) and shows how you might render this as a "MyTrip" class with distances in "travel minutes". Following along with the Monte Carlo randomness, though, he shows how to inject a bit of randomness into the mix accounting for some of the trouble he had along the way.


Link: http://phpmaster.com/running-monte-carlo-simulations-in-php

2013年6月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 06.27.2013

Recent releases from the Packagist:

The PHP.cc: Urban Legends and Error Handling


In this new post to the PHP.cc blog, Stefan Priebsch looks at the relationship between urban legends and error handing in PHP.



Ending up in such a situation [as the tourists in the urban legend] is not the fault of the underpass: the error, made somewhere upstream, merely shows up right when approaching the underpass, and is usually difficult (or at least tedious) to handle. PHP as a programming language, just like any dynamic language, may at first appear to not need overly strict validations of data. Validation of data, however, is directly related to error handling: If data is invalid, this should be an error or an exception (if you write OOP code, which you should be doing). This error needs to be handled somewhere.


He talks about how things like field and value validation can help prevent errors further down the road. He mentions the split between application and domain logic and suggests that it's the role of the app logic to prevent bad data from making it thorough to the domain.



In software development, it is crucial that you handle any errors as soon as they occur. This requires you to actually realize that an error has occurred.

Link: http://thephp.cc/viewpoints/blog/2013/06/urban-legends-and-error-handling

Anna Filina: How to Motivate Your Developers


Anna Filina has a quick new post to her site today with some helpful tips on how to motivate your developers (and coworkers) to make for the best end result.



When developers are not motivated, progress is slow and quality is low. This ultimately affects company revenues and can lead to reduced opportunities for all employees. Motivation leads in the opposite direction: wealth and happiness. The first thing to understand about motivation is that it's internal. We can't force someone to become motivated, but we can still have a strong influence. Here are my top three picks to increase motivation from my presentation at IPC 2013 in Berlin.

Her top three are:



  • Setting goals for the group and a purpose for making it good
  • Focus on the "small wins" sometimes to keep motivation high
  • Let developers use their full range of talents, don't force them into one niche

Link: http://annafilina.com/blog/motivate-developers

NuoDB.com: Using NuoDB from the PHP Zend Framework


On the NuoDB site there's a recent post showing how to use this cloud-based database solution from inside Zend Framework applications.



The Zend Framework is an object oriented PHP framework that can be used to construct interactive web applications. NuoDB supports both Zend Framework version 1 and version 2 . In this TechBlog article, I will show you how to use NuoDB with both Zend Framework v1 and v2. I will use the example applications that are provided in the Zend Framework documentation and show you how to make them work with NuoDB.


They briefly walk you through the install and configuration of Apache and NuoDB you'll need to get things up and running. Sample code is included showing you how to install the NuoDB PDO driver, pull down their github repo with the needed files (for both ZF1 and ZF2) and implementing in each version's quickstart application.


Link: http://www.nuodb.com/techblog/2013/06/20/using-nuodb-from-the-php-zend-framework

Simon Champion: PHP Upgrade Broke My Data Importer


In his latest post Simon Champion recounts some of the issues he had when upgrading to PHP 5.4, what's usually a smooth transition from PHP 5.3. His specific problem came in a difference between the previous mysql_query call and the more-correct PDO usage.



Our office is in the thoes of a large-scale upgrade of the servers in our data center. The new version of Debian (version 7, or "Wheezy") has been officially released, having been in beta for the last few millenia, and our Ops team are slowly installing it across all our servers. This is great news, as it means we get to upgrade to PHP 5.4. Woohoo! New shininess. [...] We were ready. The upgrade should have been a breeze. But it wasn't.


He talks about his process of digging through the code trying to figure out why a call to import a CSV file into MySQL was failing. Their Data Importer component started failing with an error from MySQL about the "LOAD INFILE" not being allowed for use. He shares a "work around" that's not ideal (using exec) that manually imports the file into the database. He does point out that it could be something Debian-specific as they don't upgrade the version, just apply security patches retroactively.



We're making an effort to stick to modern PHP coding standards, so we're using PDO throughout, which makes is all the more galling. [...] Given that we do have a work-around now and everything is back up and running, I'm going to have to let this one drop; I don't have the time to try chasing it any more. But I hope this blog post will prove useful to anyone else having the same issue.

Link: http://spudley.com/blog/php-upgrade-broke-my-data-importer

2013年6月26日星期三

Community News: Latest Releases from PHPClasses.org

Community News: Packagist Latest Releases for 06.26.2013

Recent releases from the Packagist:

The PHP.cc: PHP 5.5: New CLASS Constant


The PHP.cc have posted another article in their series looking at the new features that come with the latest release of PHP (5.5). In this new post they cover the "CLASS" constant.



Last week, the first stable version of PHP 5.5 was released. It introduced a class-level constant, aptly named CLASS, that is automatically available on all classes and holds the fully-qualified name of that class. [...] So why would you need such a constant? [...] When you need the fully qualified name of a namespaced class that is referenced by a namespace alias ... then it gets interesting.


He illustrates with an example of a unit test using stubs and mocks. The normal method requires the definition of the class namespace in the "getMock" call. With the CLASS constant, PHP can extract that information from the namespace referenced in the "use" and drop it in as a replacement.


Link: http://thephp.cc/viewpoints/blog/2013/06/php-5-5-new-class-constant

PHPMaster.com: Understanding Streams in PHP


PHPMaster.com has a new tutorial for those interested in how to work with streams, he base resources behind working with things like files and remote connections.



Streams are resources provided by PHP that we often use transparently, but which can also be very powerful tools. By learning how to harness their power, we can take our applications to a higher level. [...] Every stream has a implementation wrapper which has the additional code necessary to handle the specific protocol or encoding. PHP provides some built-in wrappers and we can easily create and register custom ones. We can even modify or enhance the behavior of wrappers using contexts and filters.


They start by introducing two of the most commonly used streams - "file" and "http" as well as some of the wrappers that can be used to work with them. He also talks about the "php://" stream, a special instance that lets you access things like a temporary memory block and stdout/stdin. He finishes up the tutorial with a look at "contexts" - the parameters that can be used to modify the stream wrapper (like his HTTP example).


Link: http://phpmaster.com/%EF%BB%BFunderstanding-streams-in-php

SitePoint.com: How to Add OAuth Authentication to Your Twitter App


In this quick post to SitePoint, they show you how to use the Twitter OAuth library to connect your application with the new Twitter OAuth authentication methods.



Thanks Twitter. Not only have you removed open access to public Twitter timelines, you're expecting developers to contend with cryptic authentication documentation! Many of us simply want to display our own tweets on our own website, but it's obvious Twitter prefers us to use their widgets. Despite the convoluted Twitter instructions, implementing OAuth in your lovingly-crafted API 1.0 application is reasonably straight-forward if you use the libraries provided by talented group of (non-Twitter) developers.


They break it down into a few easy steps (largely made easy because the library does most of the heavy lifting for you):



  • Create your Twitter Application
  • Create an Access Token
  • Download the OAuth Library
  • Modify Your Timeline Fetching Code

Link: http://www.sitepoint.com/twitter-1-1-oauth-php

2013年6月25日星期二

Community News: Latest PECL Releases for 06.25.2013

Latest PECL Releases:
  • mysqlnd_ms 1.5.2
    Fix hardcoded version number


  • radius 1.2.6
    - Support added for PHP 5.4 and 5.5. (Johannes)
    - Fixed bug #60885 (Radius module causing Apache segmentation fault). (Adam)
    - Fixed a crash when calling radius_server_secret() with no servers configured.
    (Adam)


  • pecl_http 1.7.6
    * Fixed bug #64380 (PHP-5.5 build fails)


  • memoize 0.2.0
    - bundled storage modules are no longer separate extensions
    - memcached module now requires libmemcached 1.0.x
    - added support for TTL by function (optional argument to memoize())
    - win32 fixes


  • riak 0.4.3
    - Bugs
    Issue9: riak.persistent.timeout now in seconds, and default changed to 5 seconds
    - Improvements
    Issue3: Streaming mapreduce
    Issue8: RiakBucket->listKey function added
    Issue7: Return updated object after put
    Issue11: Implement PBC head support
    RiakBucket->streamKeys function added
    RiakBucket->delete now accept a RiakObject or a string with the key to delete.
    - API Changes
    Issue12: RiakMapreducePhase renamed to RiakMrPhase
    RiakBucket->getObject renamed to RiakBucket->get
    RiakBucket->deleteObject renamed to RiakBucket->delete
    RiakBucket->putObject renamed to RiakBucket->put
    RiakOBject->__constructor key is now optional (if none is set on put, riak will create a random key).
    RiakBucket->put no longer accepts key as second parameter
    RiakBucket->put/get now takes an optional RiakGetRequestConfiguration


  • mysqlnd_ms 1.5.1
    GA release


Community News: Packagist Latest Releases for 06.25.2013

Recent releases from the Packagist:

The PHP.cc: PHP 5.5: Out-of-the-Box Bytecode Cache


In a new post to their site, the PHP.cc (well, Sebastian Bergmann) takes a look at the bytecode caching feature that's included in the latest release of PHP, version 5.5.



PHP is an interpreted language. The default PHP runtime, the one that can be obtained from php.net, compiles PHP sourcecode to an intermediate representation called PHP bytecode which is then executed. A bytecode cache stores this compiled representation of PHP sourcecode in shared memory. This eliminates the need to load and compile sourcecode on each request which leads to a significant increase in performance (up to 70% more requests per second).


He looks some at "the past" of PHP and how it made it up from the world of PHP 4.x to PHP 5.4 and the de-facto bytecode cache before now, APC. With the introduction of PHP 5.5, though, developers have access to an integrated version of the ZendOptimizer+ cache built right into the language. They include a little bit of documentation about how to enable it and how to install it via PECL if it's not already built in.


Link: http://thephp.cc/viewpoints/blog/2013/06/php-5-5-out-of-the-box-bytecode-cache

JetBrains Blog: Introducing PhpStorm Video Tutorials


If you're a PHPStorm user, you already know some about what the IDE can do and the features it brings to the table. If you're not, though, the folks at JetBrains have put together a set of tutorial videos to help introduce you to this powerful tool.



A lot of PhpStorm users have been asking us to create a series of video tutorials. Today, we're happy to announce the availability of about two hours of video tutorials around PhpStorm which Maarten has been working on for the past few weeks. JetBrains.TV and YouTube playlist are also available.


Videos already in the list introduce you to the IDE and its basic features, actions and navigations, several PHP-specific development topics as well as ones related to HTML-specific development.


Link: http://blog.jetbrains.com/phpstorm/2013/06/introducing-phpstorm-video-tutorials

CodeForest.com: Creating simple tasks app with Backbone.js and Slim micro framework (part 1)


New on CodeForest.com today, Luka Peharda has posted the first part of a series that combines the Slim microframework with backbone.js to make a simple tasks (to-do) application.



The app in this tutorial will be called "Tasks". I know, right? Super creative. This first article will give an introduction to the technologies and the idea of the series. Also, we'll cover project structure and entire PHP side of the story. In second article we'll cover Backbone.js side of the story and create simple tasks application which we'll refine and upgrade in later articles (third and fourth one).


They introduce the two technologies (briefly) and get right in to the directory and database structure they'll be using. They use the NotORM library for accessing the database. Code is included showing the routes for getting, adding, updating and deleting tasks out of the database.


Link: http://www.codeforest.net/creating-simple-tasks-app-with-backbone-js-and-slim-micro-framework-part-1

PHPMaster.com: Inattention Blindess - Missing the Obvious


On PHPMaster.com today there's an interesting article about something called "inattention blindness" - basically, the situation that comes up when you can't seem to find an issue/bug yet it's completely obvious to someone else.



Your code isn't working! You don't know why and you've been staring at it for what seems like hours. You're grumpy. You're falling behind schedule. You're getting increasingly irritated. Why doesn't it work? Why can't you see the bug? It can't be so hard to find, can it? Out of sheer frustration (as opposed to rational thought) you call over a coworker to help you find the problem. Within seconds they do what's been seemingly beyond you - they identify the source of the issue. To make matters worse, it's painfully simple. [...] Inattention blindness is a phenomena related to people's perception of the data they receive through their senses.


The talks about the invisible gorilla test and four theories that might cause the person to miss the obvious. He then relates this back to programming, pointing out a few reasons you might "miss the gorilla" when it comes to debugging your code:



  • Specific Language Experience / Programmer Expectations
  • Operator Overloading
  • Syntactic Noise
  • Whitespace - Vertical and Horizontal

Link: http://phpmaster.com/inattention-blindess-missing-the-obvious

2013年6月24日星期一

Community News: Latest PEAR Releases for 06.24.2013

Latest PEAR Releases:

Community News: Packagist Latest Releases for 06.24.2013

Recent releases from the Packagist:

Johannes Schlüter: PHP 5.5 is out, what's up with 5.4 and 5.3?


Johannes Schlüter has a new post for those wondering what's going to happen to PHP 5.3 and 5.4 now that PHP 5.5 has been released.



Yay, finally we released PHP 5.5, which is a new big release for PHP. In preparation for this I yesterday sent out a mail to the PHP core developers stating that the "PHP-5.3 BRANCH IS CLOSED NOW" [...] What this means for users of PHP is that they can continue using PHP 5.3 and when upgrades come they are very low risk of breaking anything (we always try not to break anything, but any person's bug might be another person's feature) so they should be applicable easily and applied fast.


So, PHP 5.3 users can upgrade in the 5.3.x series without having to worry too much about breakage. PHP 5.4 users should be able to easily upgrade to 5.5 without many issues too: "PHP 5.5 also mostly uses the same code as 5.4 with a few extra features."


Link: http://schlueters.de/blog/archives/173-PHP-5.5-is-out,-whats-up-with-5.4-and-5.3.html

7PHP.com: PHP Interview With Phil Sturgeon The Man Behind PyroCMS


On 7PHP.com Khayrattee Wassem has posted another interview with a member of the PHP community. This time it's with Phil Sturgeon, the developer behind the PyroCMS project.



In this edition I talked with Phil Sturgeon who is the founder of the CMS named as PyroCMS. He also wrote a book about it called "Catapult into PyroCMS". @Philsturgeon is very much involved in The PHP Community; he regularly participates in conferences, is a prominent voice and voting member of The PHP-Fig (aka the PHP Framework Interop Group, I also asked him a few questions about it) and he has been amongst the core contributors of PHP Frameworks like CodeIgniter (CI) and FuelPHP, although he is now opening his arms towards Laravel PHP framework (the PHP Framework for Web Artisans). On the professional scene, he is the Lead Engineer at Kapture.


They talk some about his background, how he got involved in the PHP community and some of his thoughts about PHP's growth during that time. He includes some advice to developers just getting their start (including some good resources) and some of the tools he uses in his development. There's a bit towards the end about Phil's involvement in the PHP-FIG and some of his involvement in conferences around the world.


Link: http://7php.com/php-interview-phil-sturgeon

Blake Gardner: Practical usage of PHP 5.5 generators: yield keyword


With the release of PHP 5.5 came a whole group of new features, including the "yield" keyword for better handling of values in iteration. Blake Gardner has posted a practical example of its use to his site today.



The key to understating the way the yield works verses a normal function is that rather than generating all of your data and returning the final array when it's done; you yield the value as it's generated. The state of the generator function is saved after you yield and then its state is restored when called again so the iteration can continue.


He shows a basic use of "yield" in a simple foreach of 1000000 values. In the first example, memory is exhausted and the second yields the values as they come, reducing the overhead significantly. The "range_yield" function returns them as the "for" loop generates them.


Link: http://blakegardner.co/2013/06/24/practical-usage-of-php-5-5-generators-yield-keyword

NetTuts.com: From Procedural to Object Oriented PHP


In this new tutorial from NetTuts.com, they want to help you make the move from procedural PHP to the world of Object-Oriented PHP. They opt for the mini-project approach and show you how to make a simple Google API client.



This tutorial was inspired by a speech given by Robert C. Martin that I watched a year or so ago. The main subject of his talk is about the possibility of picking The Last Programming Language. He addresses topics such as why should such a language exist? And what it should look like? However, if you read between the lines, there was another interesting idea that caught my attention: the limitations that each programming paradigm imposes upon on us programmers. So before we get into how we could go about converting a procedural based PHP app into an object oriented one, I want to cover a little bit of theory beforehand.


They start their example with a procedural approach, showing how to make the client and make a request for calendar information. They then work through the refactoring of the example, breaking it up into logical chunks (objects) and separating out some of the logic (like view versus logic). They talk about everything from basic OOP terms out to more complex ideas like SOLID.


Link: http://net.tutsplus.com/tutorials/php/from-procedural-to-object-oriented-php

2013年6月23日星期日

Community News: Packagist Latest Releases for 06.23.2013

Recent releases from the Packagist:

2013年6月22日星期六

Community News: Packagist Latest Releases for 06.22.2013

Recent releases from the Packagist: