2013年9月30日星期一

Community News: Latest PEAR Releases for 09.30.2013

Latest PEAR Releases:

Community News: Packagist Latest Releases for 09.30.2013

Recent releases from the Packagist:

Engine Yard: Podcast - Future of PHPWomen


In their latest podcast Engine Yard (as hosted by Davey Shafik) talks with Lineke Kerckhoffs-Willems and Michelle Sanver about the future of PHP Women, a group within the PHP community to help encourage women in technology and support the PHP community overall, regardless of gender.


Among the topics discussed in this episode are things like:



  • The official mission of PHPWomen
  • How to get involved
  • Future plans for the group
  • A mention of the CodeConnexx conference (Europe edition)


You can either listen to this episode through the in-page player or you can subscribe to their feeds to get this and other episodes - iTunes, RSS.


Link: https://www.engineyard.com/podcast/future-of-phpwomen

Kevin Schroeder: More - The file system is slow


As a follow-up to his previous article about the (minimal) overhead from logging, Kevin Schroeder has this new post focusing on the common belief that writing to the file system is the slowest method.



I had a conversation the other day by a person I respect (I respect any PHP developer who knows how to use strace) about the cost of file IO. My assertion has been, and has been for a long time, that file IO is not the boogeyman that it is claimed to be. So I decided to test a cross between those two posts.


His test was to write one million log records to two different sources - the normal physical file system, a RAM drive - one run with a file handle that's left open and the other with a new handle each time. He shows how he made the RAM drive and the PHP he used for the test (running in a VM). He graphs out the results with some interesting results...but you'll have to read the post for that.


Link: http://www.eschrade.com/page/more-on-the-file-system-is-slow/

Chris Hartjes: Testing Listeners


In the latest post to his site, Chris Hartjes offers some advice about unit testing with listeners to help teach PHP developers the right way to test.



I had an idea to put together some kind of "PHP Testing Koans" site as a way to help PHP developers get better at learning how to actually write tests. Most developers who are introduced to testing get blocked at the point of actually writing a test. [...] So I started to brainstorm ways to make it happen. With some help from Joel Clermont I stumbled upon using test listeners for this.


He uses the built-in test listeners for PHPUnit to write a system that checks to ensure a certain test exists in a "Koan1Listener" class. This class implements the PHPUnit_Framework_TestListener interface and has several methods to catch events and handle issues thrown during execution.



The approach is simple: for each test class that gets executed, add the names of all the methods to an internal list. When the entire test suite is finished, we then check to see if the test names that we were expecting are in our list of methods we found. I am sure there is a more efficient way to do it, so let me know in the comments of a different approach.

Link: http://www.littlehart.net/atthekeyboard/2013/09/27/test-listeners/

SitePoint PHP Blog: Collection Classes in PHP


On the SitePoint PHP blog a new tutorial introduces you to collection classes in PHP, replacing the more basic array with something with a bit more power.



Applications frequently have objects that contain a group of other objects, and this is a great place to make use of collections. [...] A Collection class is an OOP replacement for the traditional array data structure. Much like an array, a collection contains member elements, although these tend to be objects rather than simpler types such as strings and integers.


He mentions some of the common problems with arrays (and the data they contain) and points out that the structure a "Collection" class wraps around it can help keep things sane. He includes an example of a basic collection class that adds/gets/deletes items from an internal (private) array. He fleshes out this class with code inside those methods and a few others: keys, length and keyExists.


Link: http://www.sitepoint.com/collection-classes-in-php/

2013年9月29日星期日

Community News: Packagist Latest Releases for 09.29.2013

Recent releases from the Packagist:

2013年9月28日星期六

Community News: Packagist Latest Releases for 09.28.2013

Recent releases from the Packagist:

2013年9月27日星期五

Site News: Popular Posts for the Week of 09.27.2013

Popular posts from PHPDeveloper.org for the past week:

Community News: Packagist Latest Releases for 09.27.2013

Recent releases from the Packagist:

Reddit.com: Question about the relevance of benchmarking


On Reddit.com there's a new post from someone relatively new to PHP wondering what the relevance of benchmarks is in a time when most performant sites use caching (full page or data) to increase their speed.



I was speaking to another PHP developer today who is a lot smarter than me. I was curious about Static Site Generators taking over the future of the web. [He] told me that most of the time, big sites have a cache that people hit. So people don't even have to wait for PHP to be interpreted. This begs the question . . . How are performance metrics relevant for different frameworks, when these sites are being cached anyway?


There's several comments on the post now with a few different opinions like:



  • "Most of the benchmarks you'll see are dishonest and/or skewed as they don't paint an accurate picture of what's going on, or how they would be used in the real world."
  • "As soon as you start taking too much time to return a page to a user you have a knock-on effect where you develop a queue of other users waiting for their page to be returned as well."
  • "So far as performance benchmarks go, the framework and language used in your application becomes redundant once you add a caching layer as the page performance is then limited by what caching layer you use."
  • "as a rule of thumb "logged out users see cached content" "logged in users see uncached content""

Link: http://www.reddit.com/r/PHP/comments/1n5ygr/i_am_an_idiot_question_about_the_relevance_of

Engine Yard Blog: Deploying PHP Applications on Engine Yard: A How-To


Matthew Weier O'Phinney has written up an article for the Engine Yard blog walking you through the full process of getting a PHP site set up and working with their platform-as-a-service hosting.



I've been experimenting with a variety of cloud Platform as a Service (PaaS) offerings lately, and naturally was interested in seeing what Engine Yard brought to the table for PHP developers with its Engine Yard Cloud offering. Deployment of my application includes several non-trivial aspects, and I wanted to see how easy, or difficult, it was to accomplish each.


He lists some of his criteria (including deployment from a git repo, usage of Composer and cronjobs) and notes that the EY service matches all of his needs. The rest of the post goes into the details of the deployment, breaking it up into sections:



  • Initial deployment: Git and Composer
  • Private Configuration setup
  • Deployment Tasks
  • Cronjobs
  • DNS

Link: https://blog.engineyard.com/2013/deploying-php-applications-on-engine-yard-a-how-to

Kristo Vaher: What you should know about API-centric web development and design


Kristo Vaher has an interesting post looking at a development technique that's becoming more and more popular among web applications - API centric design. More development is being focused around reusable APIs than just making applications. Kristo fills you in on a few things you need to know about this technique and some things to watch out for along the way.



Modern web applications are often anything but stateless and consist of layers upon layers of session handling and asynchronous requests, where users can log in and their functionality is dependent upon dozens of checks before a page is returned to their web browser. In order to manage this problem a little better, we have to take discover - or rediscover - something that has existed in desktop software development for a dozen years: API-centric development and design.


For those new to the topic, he explains what an API is and how centering your development focus on it can help in the long run. He suggests that the API should be the software and everything else - clients, outside users, etc - just interacts with it. Some solutions are offered to help encourage this development including:



  • Using a MVC (Model/View/Controller) structure
  • Starting from day one to develop the API
  • Planning before writing any code
  • How teams should be working together, but on different elements

Link: http://waher.net/archives/1158

David Adams: Zero to Jenkins - PHP Continuous Integration


David Adams has posted another screencast to YouTube, this time it's about setting up Jenkins for continuous integration in a PHP-based application. (His previous one about using PHP on Digital Ocean is here).



The tutorial walks you through the entire process, including creating the Vagrant configuration:



  • Installing Jenkins via apt-get
  • Setting up the commands needed to run jobs
  • Configuring it to work with a Bitbucket project
  • Installing plugins/upgrades
  • Security configuration


He also shows some of the results of the job executions, both passing and failing. The video's about 50 minutes long, so it's not a quick installation but it is detailed.


Link: https://www.youtube.com/watch?v=PklYO2vYIfc

2013年9月26日星期四

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 09.26.2013

Recent releases from the Packagist:

Russell Walker: Public properties, getters and setters, or magic?


Russell Walker has a recent post to his site looking at different ways to work with class properties including using them as public properties or using getters and setters.



Opinion seems to be divided on whether it is good practice to use public properties in PHP classes, or whether to use getter and setter methods instead (and keep the properties private or protected). A sort of hybrid third option is to use the magic methods __get() and __set(). As always, there are advantages and disadvantages to each approach, so let's take a look at them.


He breaks the rest of the post up into three sections, each with a bit of a code example and the common advantages/disadvantages. It's a good overview of the three types and, in the end, it's mostly about what works for your applications. What's his favorite?



My choice then is to use public properties most of the time, but getters and setters for critical settings that I feel need stricter control, would benefit from lazy loading, or that I want to expose in an interface.

Link: http://russellscottwalker.blogspot.co.uk/2013/09/public-properties-getters-and-setters.html

David Adams: PuPHPet and Digital Ocean (Screencast)


Over on YouTube David Adams has posted a video showing you how to use PuPHPet with Digital Ocean. PuPHPet is a easy to use, graphical tool to help make building Vagrantfiles quick and easy. Digital Ocean bills itself as a cloud service "built for developers" that lets you spin up cloud servers quickly.



The video's about 30 minutes long, but it walks you through the entire process. It's a screencast you can easily follow along with. Unfortunately some of the text is a bit small (and hard to read full-screen) but he talks you through the commands too, which helps.



You can find out more about Digital Ocean's "droplets" here.


Link: https://www.youtube.com/watch?v=dHkTxWffGGA

Systems Architect:API-based Web Application with Backbone, Require.js and Slim framework


On the Systems Architect blog there's a new post from Lukasz Kujawa about creating a simple API-based application combining Slim, Require.js and Backbone. The result is a single-page application that displays a template and a set of links pulled from the backend.



A single-page application (SPA) was something I've been exploring for the last few months. I always liked the idea of moving certain responsibilities to the client's side. After all, why would you like to waste server's RAM/CPU to buil a HTML page (and pay for a transfer to deliver it) when a web browser is perfectly capable of doing that on its own?


He's posted the full example to Github, but he does walk through all the code showing how the parts fit together. He starts with the HTML5 template and Javascript side of things, making a simple Backbone router and a "create" route. The views are rendered via the Lo-Dash templating and injected into the page.



As you can see it's all quite simple. The only problem is that you have to embrace multiple JavaScript frameworks at once but the boilerplate makes it much easier. What I really like about this setup is the structure. It's similar to how things are done in the back-end and it should be fine even with big applications.

Link: http://systemsarchitect.net/api-based-web-application-with-backbone-require-js-and-slimmvc-framework

SitePoint PHP Blog: Creating a Subscription-Based Website with Laravel and Recurly, Part 1


On the SitePoint PHP blog there's a post by Lukas White (part one of a series) showing you how to make a subscription-based website with Laravel and Recurely. Recurly is a subscription billing service that takes case of the recurring billing process.



In this two-part series I'll show you step-by-step how to create a paid subscription-based membership website using Laravel, a PHP5-based framework, and the Recurly payment processing service. First we'll start by creating a simple site with basic registration, authentication, and user roles and permissions. Then we'll add payment processing and tie it into the registration process, allowing people to purchase different membership tiers.


He walks you through the full process (well, the first part of it at least) to getting a new Laravel project up and going and a few other libraries you'll need to connect to the Recurly service. He creates a simple user table and roles/permissions functionality for the Authority connections. He also shows how to make the basic template, login mechanism and user registration system.


Link: http://www.sitepoint.com/creating-subscription-based-website-laravel-recurly-1/

2013年9月25日星期三

Community News: Latest Releases from PHPClasses.org

  • PHP Ubuntu One Backup

    Package:


    Summary:

    Send MySQL database backup files to Ubuntu One

    Groups:


    Author:


    Description:

    This class can send MySQL database backup files to Ubuntu One...



    Read more at http://www.phpclasses.org/package/8269-PHP-Send-MySQL-database-backup-files-to-Ubuntu-One.html






  • torm

    Package:


    Summary:

    Store and retrieve objects using ActiveRecord

    Groups:


    Author:


    Description:

    This class can be used store and retrieve objects using ActiveRecord...



    Read more at http://www.phpclasses.org/package/8254-PHP-Store-and-retrieve-objects-using-ActiveRecord.html






  • Ninja Mutex

    Package:


    Summary:

    Lock resources to prevent simultaneous accesses

    Groups:


    Author:


    Description:

    This package can lock resources to prevent simultaneous accesses from different processes...



    Read more at http://www.phpclasses.org/package/8257-PHP-Lock-resources-to-prevent-simultaneous-accesses.html






  • Plesk Server API

    Package:


    Summary:

    Manage hosting accounts using the Plesk API

    Groups:


    Author:


    Description:

    This class can manage hosting accounts using the Plesk API...



    Read more at http://www.phpclasses.org/package/8251-PHP-Manage-hosting-accounts-using-the-Plesk-API.html






  • Multipart CSV

    Package:


    Summary:

    Write data into multiple CSV files of limited size

    Groups:


    Author:


    Description:

    This class can write data into multiple CSV files of limited size...



    Read more at http://www.phpclasses.org/package/8250-PHP-Write-data-into-multiple-CSV-files-of-limited-size.html






  • Debug Info

    Package:


    Summary:

    Output information about variables and other data

    Groups:


    Author:


    Description:

    This class can output information about variables and other data...



    Read more at http://www.phpclasses.org/package/8264-PHP-Output-information-about-variables-and-other-data.html






  • Basic Auto-loader

    Package:


    Summary:

    Register auto-loader for classes defined in arrays

    Groups:


    Author:


    Description:

    This class can register an auto-loader for classes defined in arrays...



    Read more at http://www.phpclasses.org/package/8270-PHP-Register-auto-loader-for-classes-defined-in-arrays.html






  • DebugInfo

    Package:


    Summary:

    Output information about variables and other data

    Groups:


    Author:


    Description:

    This class can output information about variables and other data...



    Read more at http://www.phpclasses.org/package/8264-PHP-Output-information-about-variables-and-other-data.html






  • Horas Laborales

    Package:


    Summary:

    Calculate the number of worked hours between dates

    Groups:


    Author:


    Description:

    This class can calculate the number of worked hours between dates...



    Read more at http://www.phpclasses.org/package/8261-PHP-Calculate-the-number-of-worked-hours-between-dates.html






  • Tree Query

    Package:


    Summary:

    Generate conditions to get tree elements

    Groups:


    Author:


    Description:

    This class can generate conditions to get tree elements...



    Read more at http://www.phpclasses.org/package/8248-PHP-Generate-conditions-to-get-tree-elements.html






  • Autocomplete

    Package:


    Summary:

    Suggest words to complete search using edge n-gram

    Groups:


    Author:


    Description:

    This class can suggest words to complete search using the edge n-gram algorithm...



    Read more at http://www.phpclasses.org/package/8230-PHP-Suggest-words-to-complete-search-using-edge-n-gram.html






  • PHP Detect Device Type

    Package:


    Summary:

    Detect the type of device the user is using

    Groups:


    Author:


    Description:

    This class can detect the type of device the user is using...



    Read more at http://www.phpclasses.org/package/8256-PHP-Detect-the-type-of-device-the-user-is-using.html






  • IFrameYou

    Package:


    Summary:

    Generate HTML to embed video players

    Groups:


    Author:


    Description:

    This class can generate HTML to embed video players...



    Read more at http://www.phpclasses.org/package/8249-PHP-Generate-HTML-to-embed-video-players.html






  • PHP Spearman Rank Correlation

    Execution sample

    Package:


    Summary:

    Compute the Spearman Correlation and draw results

    Groups:


    Author:


    Description:

    This class can compute the Spearman Rank Correlation and draw the results...



    Read more at http://www.phpclasses.org/package/8226-PHP-Compute-the-Spearman-Correlation-and-draw-results.html






  • PHP Convex Hull

    Package:


    Summary:

    Find a convex shape that contain a set of points

    Groups:


    Author:


    Description:

    This class can find a convex shape that contain a set of points known as the convex hull...



    Read more at http://www.phpclasses.org/package/8220-PHP-Find-a-convex-shape-that-contain-a-set-of-points.html






  • PHP Compare Images Similarity

    Package:


    Summary:

    Compare two images to find if they are similar

    Groups:


    Author:


    Description:

    This class can compare two images to find if they are similar...



    Read more at http://www.phpclasses.org/package/8255-PHP-Compare-two-images-to-find-if-they-are-similar.html