2011年3月31日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Voices of the ElePHPant: Interview with Jonathan Wage


The Voices of the ElePHPant podcast has released their latest episode - an interview with Jonathan Wage, one of the developers on the Doctrine project.



Cal's "three questions" this time are:



  • When you're working on an open source project like Doctrine, what's the hardest thing about that?
  • What was the best new feature of PHP 5.3?
  • How do you recruit new developers for the Doctrine project?


You can listen to this latest episode via the in-page player or by downloading the mp3. You can can also subscribe to their feed and get this and other great episodes automatically.

LearnComputer.com: Best PHP Books: My Top 5 Choices


On LearnComputer.com there's a new post with their top five choices of PHP books they see as good resources for any developer wanting to improve their grasp of the language.



Continuing with our best-five-book series, today we are introducing our pick of the top 5 PHP books. Obviously, PHP has been around much longer than our other review subjects such as Android or HTML5, and there is a greater general variety of books to choose from.


Their list of top five covers a pretty good range of skillsets, but leans more towards the introductory level:



  • Professional PHP6 (and yes, they mention that the title is "blatant false advertising" since PHP6 is nowhere to be found)
  • Learning PHP, MySQL, and JavaScript: A Step-by-Step Guide to Creating Dynamic Websites
  • PHP Solutions: Dynamic Web Design Made Easy
  • Beginning PHP and MySQL: From Novice To Professional
  • Head First PHP & MySQL

2011年3月30日星期三

Community News: Latest Releases from PHPClasses.org

PHPClasses.org: Lately in PHP Podcast Episode 10 - the Built-in Web Server, PHP 5.3.6 & PHP.js


PHPClasses.org have posted their latest episode of the "Lately in PHP" podcast today, a discussion between Manuel Lemos and Ernani Joppert about the built-in web server that's planned for inclusion in future releases of the PHP language.



PHP is going to come with a built-in Web server, so you will no longer need Apache or any other Web server software to run PHP applications. This is the main topic discussed by Manuel Lemos and Ernani Joppert in the episode 10 of the Lately in PHP podcast.


They also talk about some security fixes and the PHP.js project. As usual, you can listen to this latest episode either through the in-page player, by downloading the mp3 or by subscribing to their feed.

Web Builder Zone: Struts vs. Zend Framework


New on DZone.com's Web Builder Zone, there's an article from Giorgio Sironi comparing Struts to the Zend Framework (Struts, of course, being a standard Java MVC framework that's quite popular in that community).



This article is intended to be useful for who experiences a transition between Java and PHP, but also to learn what could be imported in a framework from the other. Keep in mind that in the PHP world using a framework is probably still not considered the default option (going with or without frameworks is a choice which is out of the scope of what I want to discuss today instead.) Let's see what surprises you when jumping from Zend Framework to Struts, or the other way around.


He compares them against each other mentioning things like the single servelet vs front controller idea, action classes vs action controllers, persistence, JSP vs embedded PHP and tag libraries vs view helpers.

2011年3月29日星期二

Community News: Latest PECL Releases for 03.29.2011

Latest PECL Releases:

Voices of the ElePHPant: Interview with Vid Luther


The Voices of the ElePHPant podcast has posted their latest episode - an interview with Vid Luther,



Cal's "three questions" of choice this time center around Vid's community experience:


  • How did you get involved in the PHP community?
  • What's the biggest benefit you or your company/employer gets from participating in the PHP community?
  • What's the easiest way to get involved in the PHP community?



As always, you can listen to this latest episode via the in-page player, by downloading the episode or by subscribing to their feed.

Sameer Borate's Blog: Data filtering and validation using Inspekt


Sameer Borate has a recent post to his blog looking at an important part of any application - filtering input from the user and output before its used. In his examples he uses a library called Inspekt (from Ed Finkler) to make the job a lot easier.



Most web security glitches are caused by insufficient input filtering and validation. Despite a large number of validation libraries being available, input sanitization is usually bypassed due to sheer laziness or the idea that your site is somehow immune from bad input data. Inspekt is one such library that has a small footprint and is very easy to integrate into your application.


He goes through the installation (a require_once) and a few examples of how to "cage" incoming data from a sample form with two hidden fields. He shows how to use the library to access the filtered versions of the values and how to run some tests on the data (like checks for alphanumeric, valid hostname, between two values, valid phone number, etc). He also briefly mentions "super cages" that can be used over and over.

Stuart Herbert's Blog: Series: Beyond Frameworks


Based on his Beyond Frameworks session presented at this year's PHP UK Conference 2011, Stuart Herbert is in the process of creating a series of posts based about its contents:



[In my session] I explained how a component-based architecture can help answer some of the important (i.e. expensive!) questions you might face when creating long-lived apps that rely on a PHP framework. In this series of blog posts, I'm going to look at how to go about creating and working with components.


As of the time of this post, there's three different sections - "Getting Started", "The Tools We Use" and "Working with PHP Components" - and lots of posts to match. The large part of the series has been focused in the components area with articles about planning, unit tests and making PEAR-compatible packages.

2011年3月28日星期一

Community News: Latest PEAR Releases for 03.28.2011

Latest PEAR Releases:

Gonzalo Ayuso's Blog: Performance analysis fetching data with PDO and PHP.


Gonzalo Ayuso has a new post to his blog today with the results of some performance analysis he ran when fetching data with PHP and PDO.



Fetching data from databases is a common operation in our work as developers. There are many drivers (normally I use PDO), but the usage of all of them are similar and switch from one to another is not difficult (they almost share the same interface). In this post I will focus on fetching data.


He includes his sample scripts - one using just fetch() and the other using fetchAll() - that include some timing and memory checking logic and includes the results of his "limit 10000" queries from his tables. Not surprisingly, the fetchAll required more memory than the fetch call. Event changing it to a loop of fetch() methods results in about the same amount of memory as a fetchAll.

Chris Shiflett's Blog: PHP Session Debugging


In a new post to his blog today Chris Shiflett takes a look at something a lot of PHP developers take for granted, the language's session handling, and some things you can do to help debug them when things go wrong.



For many PHP developers, calling session_start() and using $_SESSION for stuff you want to persist from page to page is all there is to know about sessions. This is understandable, because PHP's native session support is so simple and reliable. But, what if something goes wrong?


He points to two older articles he's written about some more advanced session handling and includes sample code acting as a walk-through for locating your problem spot. He focuses in on the read() handler method and shows how to debug the data flowing in and out (and some of the information he commonly logs from it).

2011年3月25日星期五

Site News: Popular Posts for the Week of 03.25.2011

Popular posts from PHPDeveloper.org for the past week:

Sameer Borate's Blog: Easy thumbnail generation using PHP


Sameer Borate has a recent post to his blog looking at a simple way to create thumbnails with the help of the PHP_Thumb tool.



One of the frequent requirements in web design is that of thumbnail generation. Although there are many libraries out there I found PHP Thumb simple and quick enough to implement in a recent project. PHP Thumb is a light-weight image manipulation library aimed at thumbnail generation. It offers the ability to resize, create custom crops, or square crops from the center, and rotate the image. If the need arises you can also easily add custom functionality to the library through plugins.


Code examples are, of course, included in the post showing simple thumbnail creation, image rotation, cropping, resizing and outputting to a different format. There's a brief mention of custom plugins and the ability to chain functions.

Stoyan Stefanov's Blog: JavaScript-style object literals in PHP


Stoyan Stefanov has a new post to his blog looking at bringing something to PHP that Javascript developers have always had - object literals. These literals allow you to assign object properties at definition time instead of the usual PHP method of adding them either in the class definition or after the object exists.



Stoyan starts with an example of the object literals on Javascript and shows how it's (sort of) possible to replicate that wit type casting an array to an object in PHP. The tricky part comes in when you try to recreate the method handling JS gives in objects. Closures in PHP 5.3 comes close, but there's a few things he points out that just won't work the same way.



You can simulate some of this with __call method handling in a base "JSObject" class. For more details on his work bringing Javascript over to the world of PHP, check out his presentation from this year's ConFoo conference.

2011年3月24日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Saltwater.eu: PHP Cloud Management: Orchestra vs. PHP Fog


From Saltwater.eu today there's a comparison of PHPFog and Orchestra, two services that offer cloud-based scalable PHP deployments that can happen at the push of a button.



I am evaluating these platforms in order to see if either one can ease my sysadmin burden. Well, so far, as with any cloud service promising the next best thing since sliced bread, I got mixed feelings. For the moment I tested just the free tier of both platforms. While Orchestra uses a pay-as-you-go model, PHP Fog asked for $29/mo in order to drag that number of servers slider. That's a little bit much for a plain evaluation aka not so cloud-ish model where you don't need upfront investments.


The reviewer walks through the setup of each side - the server creation and configuration, how things are handled with the load balancer, the caching layer, the application server technology stack, app design considerations and the deployment process.

Wojciech Sznapka's Blog: Dynamic LAMP setup for localhost development


In a recent post to his blog Wojciech Sznapka shows you how to set up your local development environment so that you're not having to configure a VirtualHost (assuming you're using Apache, of course) each time you want to work on a new project.



If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app. [..] We can ommit two lasts steps [of a typical setup process], limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.


His tip uses the mod_vhost_alias module for Apache and the dnsmasq tool to make the basic DNS server to resolve these custom domains. A few configuration changes later (included) and you're set to restart apache and be on your way.

2011年3月23日星期三

Community News: Latest Releases from PHPClasses.org

ServerGrove Blog: One month to go for the PHP Community Conference


The ServerGrove blog has a new post today giving you a one month reminder about the upcoming PHP Community Conference happening April 21st and 22nd in Nashville, TN.



We talked about the PHP Community Conference a couple of months ago. At the time, we got on board because of the philosophy and leadership behind it. Community is what drives PHP and the PHP community is not only about the code, but also about sharing ideas, workflow, tools, collaboration, vision and startups.


This time they look at things slightly different and mention some of the folks presenting sessions for the event. These include names familiar to the community including Rasmus Lerdorf, Matthew Weier O'Phinney, Lorna Mitchell and Joel Perras. If you'd like more information about the event or to just pick up a ticket of your own, check out the PHP Community Conference website.

php|architect: Webcast: Phactory


On php|architect.com today they've posted the recording of one of their webcast series leading to up the tek11 conference from Chris Kite and Josh Butts about Phactory.



Phactory is an alternative to using database fixtures in your PHP unit tests. Instead of maintaining a separate XML file of data, you define a blueprint for each table and then create as many different objects as you need in your PHP code. By using a database factory instead of fixtures, your unit tests will be more clear and easier to write. You'll also be able to change the objects you create programmatically instead of being stuck with the same old fixtures.


You can watch the video (with slides for the presentation) either through the in-page player or by downloading the file itself.

2011年3月22日星期二

Community News: Latest PECL Releases for 03.22.2011

Latest PECL Releases:

Gonzalo Ayuso's Blog: Howto Send/Read SMSs using a GSM modem, AT+ commands and PHP


Gonzalo Ayuso has a new post to his blog today showing how you can send and read SMS messages with PHP through a GSM modem. The AT+ commands they use can be sent via a serial (or serial-to-usb) interface directly from your application to a local device. He includes both code and some sample AT commands to get the ball rolling.



GSM modems are similar than normal modems. They've got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That's means we can send (and read) SMSs and create scripts to perform those operations. [...] The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface).


His base SMS class provides open, close and read methods that talk with the device set in a child class (in this case "/dev/ttySO"). The sendSMS method is defined to take in the number to send to and the message. The AT command examples show how to send the SMS message, read all of the messages waiting and delete an SMS from the device. You can get the full code from github.

Volker Dusch's Blog: Mandatory "Template Engines (Twig) vs Plain Old PHP" Post


Volker Dusch has posted what he calls his mandatory templating post comparing the benefits of using plain PHP for templates versus the Twig.



If you read some of my previous posts you know me as a "clean code" guy. I like readable, understandable and maintainable code. The same goes for templates. I need to be able to parse very quickly what is happening.. at least i want to.


He argues that, because the syntax of something like Twig is so much simpler and more readable, it's a better solution in the long run (technical considerations not withstanding). As an example he provides a side by side comparison visual image of the a template for each.

Kevin Schroeder's Blog: Integrating Zend_View with WordPress


Kevin Schroeder has a recent post to his blog showing how he integrated Zend_View into a WordPress install for his blog. It was as a part of a plugin he uses on some of his internal pages.



I just read a blog post about integrating Zend Framework and WordPress and figured I'd add some commentary of my own, since I've done something similar. In my ESchrade plugin I use Zend_View to render some of my admin pages, though there is no reason why you couldn't use it elsewhere, as long as the plugin has already been loaded.


Adding the functionality is easy as long as the Zend Framework install is in your include path. He gives some sample code that creates the view object, defining the templates path and pulling in the "wp_register_sidebar_widget" WordPress method to import the view.

2011年3月21日星期一

Community News: Latest PEAR Releases for 03.21.2011

Latest PEAR Releases:

Stuart Herbert's Blog: Introducing phix


In a new post to his blog Stuart Herbert has introduced phix, a packaging tools that can be used to manage and install different components in a framework-agnostic sort of way.



phix is a small command-line tool for PHP applications. I created it to fix (pun intended) the problem of how to easily automate the tasks involved in creating and (especially) maintaining components. These tasks aren't built into phix; they are commands that ship with the phix distribution. You can create your own commands to run inside phix too, and it's easy to do so


The phix tool (easily installed from PEAR) lets you either use built-in commands or custom ones to manage libraries with a few different kinds of commands - current status, initialize a library, upgrade a library and manage the full web application. As of the time of this post, the current version is phix-0.10.4.

QaFoo.com Blog: Howto write a Rule for PHPMD


On the QaFoo blog today Manuel Pichler has written up a guide to help you write a custom rule to use with the PHP Mess Detector (PHPMD) as extended from some of the current rules (it's always easier to start from examples).



Let us start with some architecture basics behind PHPMD. All rules in PHPMD must at least implement the PHP_PMD_Rule interface. You can also extend the abstract rule base class PHP_PMD_AbstractRule which already provides an implementation of all required infrastructure methods and application logic, so that the only task which is left to you is the implementation of the concrete validation code of your rule.


He walks you through some sample code and talks about some of the common interfaces that are available to your testing. He takes one of them, IFunctionAware, and looks at it specifically, showing how to use it to detect and add violations for the validation. He includes an example of writing a rule based on an existing software metric (in this case, the number of public methods). There's also bit at the end showing how to write a rule based on the "abstract syntax tree" to be able to check just about anything in the code you're looking to test.

2011年3月18日星期五

Site News: Popular Posts for the Week of 03.18.2011

Popular posts from PHPDeveloper.org for the past week:

Fabian Schmengler's Blog: "Mocking" built-in functions like time() in Unit


In a recent post to his blog Fabian Schmengler looks at mocking something in your unit tests that could cause problems in certain situations - needing a specific kind of response from a built-in PHP function. In his case, he shows how to mock time to return the same formatted date.



A common problem in Unit Testing in PHP is testing something that depends on the current time. For a determined test it should be possible to set the time in your test script without really changing the system settings. In this article I'll describe how it is usually done with OOP and then come to an alternative solution with much less code that makes use of the new features in PHP 5.3.


He shows a usual approach using dependency injection and a class wrapper to handle the set and fetch of the date value. His alternative uses namespacing to redefine the internal PHP function into something custom. Then, when the test is executed, it can use that custom namespace's version, overriding the default. It's a pretty seamless option and can save you a good bit of time and hassle with other classes each time you need to customize the results.

Jeremy Brown's Blog: 3 Tenets for Implementing a REST API


Jeremy Brown, after working tirelessly on a REST API based around the Zend Framework (and a few other technologies), has come up with his three tenets for implementing a REST API to hopefully help you along the straight and narrow path that he forged himself.



In the course of performing my duties at my day job I recently came across the need for our data to be accessible via an API. After researching the various types available, I settled on developing a REST API. The selection process wasn't the interesting part of this exercise though. Actually implementing a REST API is what was.


His advice ranges from the general to very specific, sharing tips on how to most effectively create the service's API:



  • REST is a set of principles (and not a specification)
  • Do not use custom media types
  • Represent the headers in the response payload

Web Builder Zone: Which PHP framework would you use today for a brand new application?


On the Web Builder Zone today Gorgio Sironi asks you, the larger development population of the web, what framework would you use today to start a new application?



One of the difficult parts of framework adoption, especially in the PHP world, is about choosing the right framework. There is a proliferation of open source solutions and a team must analyze the overall picture thoroughly before locking itself into a particular framework. Changing the framework which an application is built with without shaking its foundations would be probably impossible after a certain period of development.


He lists a few of the things he looks for in a framework - functionality, performance, community and a good license - and asks for some feedback (in the form of a poll) as to which you'd prefer to use next. He's narrowed it down to four options: Zend Framework, Symfony, CodeIgniter and CakePHP. (Expect plenty of comments asking "what about [insert framework here]?")

2011年3月17日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Voices of the ElePHPant: Interview with Ivo Jansch


The Voices of the ElePHPant podcast has posted their latest episode today - an interview with Ivo Jansch of Egeniq, a mobile development company.



Cal asks his traditional "three questions":



  • What's your background in programming and how did it lead you to PHP?
  • What insight do you have to share with other managers about hiring active PHP community members?
  • What advice to do you have community members looking to attract the attention of hiring managers?


You can either listen in-page, by downloading the mp3 or by subscribing to their feed.

Chad Lung's Blog: A quick intro to using PHP PDO with MySQL


Chad Lung has posted an introduction to PDO, PHP Data Objects, in a simple PHP script:



PHP PDO (PHP Data Objects) ship with PHP 5.1 and above and is very easy to work with. Today I'm going to show you one way of performing CRUD actions on a MySQL database using PDO. Keep in mind what I'll show you is only one way of doing things and just a fraction of what PDO can do.


He shows how to connect it to your MySQL database (via the connect string) and, based on his sample "pdo-demo.users" table, use prepared statements to insert and select data into/out of the table. There's a full code listing at the end showing a comprehensive view of each of the types - select, insert, update and delete.

2011年3月16日星期三

Community News: Latest Releases from PHPClasses.org

Gonzalo Ayuso's Blog: Real time notifications with PHP


In a new post Gonzalo Ayuso about a system he's developed to create real-time notifications for PHP applications using a mix of PHP and javascript (jQuery).



Real time communications are cool, isn't it? Something impossible to do five years ago now (or almost impossible) is already available. Nowadays we have two possible solutions. WebSockets and Comet. [...] I prefer to use comet (at least now). It's not as good as websockets but pretty straightforward ant it works (even on IE). Now I'm going to explain a little script that I've got to perform a comet communications, made with PHP.


His little sample application detects when a user has clicked on a link by subscribing to an event and using the javascript callback to send the message of a click event and wait for a response. You can find the complete code for the example over on github.

Sebastian Bergmann's Blog: Visualization of PHPUnit Development


On his blog Sebastian Bergmann has a recent post about how he's visualizing PHPUnit's development and pushing that information into a video based on the history of the project.



According to svn.php.net, I committed the first PHPUnit code to cvs.php.net on November 27th 2001 and the first release, PHPUnit 0.1, was made on December 1st 2001. [...] On December 26th 2009, I moved the development of PHPUnit from svn.phpunit.de to GitHub. I imported the history from Subversion into Git. As you can see in the video, moving to GitHub lead to an increased number of contributions to PHPUnit.


You can watch the video either embedded in his post or directly from Vimeo. It's interesting to watch the progress of the application and see the contributions make to each of the parts. The whole video, spanning the entire commit history of the tool, lasts about 25 minutes.

2011年3月15日星期二

Community News: Latest PECL Releases for 03.15.2011

Latest PECL Releases:

Community News: "Ideas of March" Kicks off a "Blogging Revival"


In an effort to create a "blog revival", Chris Shiflett has encouraged a movement among members of the PHP community to get back involved with their blogs - the Ideas of March:



Most conversation has moved from blogs to Twitter, and although Twitter is more active than blogs ever were, there are fewer quality conversations and debates taking place as a result of this transition. I'm hoping you'll join me in a blog revival.


He suggests that, during the month of March, bloggers band together and write more posts and make more comments than usual to bring out that good content that Twitter loses in it's 140 characters. He shares a few suggestions of the steps to take to join in - write the post, pledge to write more the rest of the month and point out your entry on twitter.



Several members of the PHP community have already posted their "Ideas of March" posts:




If you've written your own "Ideas of March" blog post, let us know and we'll add it!

9Lessons: Payment System with Paypal


On the 9Lessons blog today Srinivas Tamadashows you how to create a simple PayPal interface between their API and your site to make accepting payments easier.



I received a tutorial requests from my reader that asked to me how to implement payment gateway system with Paypal API. In this post I want to explain how to work with Paypal Sandbox test accounts for payment system development and sending arguments while click buy now button. It's simple and very easy to integrate in your web projects.


He includes the SQL to create a basic database for storing product and sales information (as well as a bit of user data linked to them) as well as instructions on creating the accounts you'll need on the PayPal side. The script creates a form that takes the payment information and pushes it to a script on the PayPal side for validation and charging.

Voices of the ElePHPant: Interview with Pablo Godel


The Voices of the ElePHPant podcast has posted their latest interview with Pablo Godel of ServerGrove, a PHP framework-friendly hosting provider.



Cal asks him his "three questions" about:



  • How did you get involved with hosting and PHP?
  • How do you see the adoption of PHP 5.3 of your clients (and for those that haven't adopted, what are the major roadblocks)?
  • What's the biggest challenge for you, a hoster of PHP websites?


You can either listen via the in-page player, by downloading the mp3 or by subscribing to their feed.

IBM developerWorks: Create a PHP development environment on the cloud


On the IBM developerWorks site today there's a new tutorial from Daniel Krook showing you how to use the IBM Cloud product to set up a development environment based on a Red Hat Enterprise server distribution with Zend Server as the PHP environment.



This article explains what makes cloud computing appealing to PHP developers and provides step-by-step instructions how to use the IBM Cloud to set up a PHP and DB2 development environment quickly. Learn how to provision Linux data and web application servers, connect to the virtual machines via SSH, use X Forwarding to install a pre-configured PHP distribution, and test your connection to DB2.


He starts with some benefits that the IBM Cloud can bring to developers and lists a few common goals that they look for in their development platforms. The rest of the post walks you through the setup and install of a sample instance - adding and configuring it, connecting via an SSH connection and installing Zend Server to give you a simple, hassle-free installation of a PHP environment.

2011年3月14日星期一

Community News: Latest PEAR Releases for 03.14.2011

Latest PEAR Releases:

Query7.com: A Look At PHP 5.3 Frameworks - Symfony2


On Query7.com today they've posted the first in a series looking at frameworks that are more PHP 5.3 centric. They start things off with a very popular framework that currently has a major update in the works - Symfony2.



Ever since PHP5.3 was released we have seen several new frameworks pop up in the PHP community. In this series of articles we will look at and evaluate some of the next generation PHP frameworks. Today we look at Symfony2.


He starts with an overview of what the framework has to offer - things like the expected MVC structure, database integration with Doctrine2 and templating with Twig - as well as its heavy use of dependency injection. He also mentions its ability to use PHP, XML or YAML for configuration files as well as other features like bundles, large support for testing and built-in HTTP caching. He also briefly mentions something that is the heart and soul of any open source project - its community.

Paul Jones' Blog: Include-Based vs Class-Based Architecture


Paul Jones has a new post to his blog looking at two approaches to building applications in PHP - either using an include-based of class-based architecture, briefly looking at the advantages and disadvantages of each.



This is a topic I describe at length in my Organizing [Your PHP Projects] talk, but I would like to give the idea a home on my blog for easy reference.


He talks about the typical structure of a PHP application - at least where most start out - being the "include" method. He talks about the progression it usually makes into functions and classes and then, eventually, a jump in concept to the "class" method similar to what several popular frameworks have gone with.



The difference is that no program logic is executed at loading time with a class file. Loading the class file makes it available for use, but the programmer has to instantiate it and then call methods on it for anything else to happen.

Ruslan Yakushev's Blog: PHP Manager for IIS is available in 5 languages


In a quick post Ruslan Yakushev points out that the PHP Manager for IIS is now available in five different languages to make it even simpler for the non-English speakers out there to use.



A new release of PHP Manager for IIS (version 1.1.2) is available for download. This release includes translations into 5 languages. [...] Note that this release still includes English and it is recommended to upgrade even if you do not need these translations


The new languages are German, Dutch, Turkish, Japanese and Russian and the post thanks each of the community members that helped with the translation. The PHP Manager for IIS is a tool for managing one or more PHP installations on a single IIS server.

2011年3月11日星期五

Site News: Popular Posts for the Week of 03.11.2011

Popular posts from PHPDeveloper.org for the past week:

Brian Swan's Blog: SQL Server Driver for PHP Connection Options: Encrypt & Failover_Partner


Brian Swan has posted two more in his "SQL Server Driver for PHP" series looking at some of the connection options that are available. In these two new articles he looks at the Failover_Partner and Encrypt options.




Database mirroring is primarily a software solution for increasing database availability. [...] When a PHP application connects to the primary server, the Failover_Partner connection option specifies the name of the server to which the application should connect if the primary server is not available.



[...] These two options, Encrypt and TrustServerCertificate, are often used together. The Encrypt option is used to specify whether or not the connection to the server is encrypted (the default is false). The TrustServerCertificate option is used to indicate whether the certificate on the SQL Server instance should be trusted (the default is false).




In both there's code examples showing the connection strings and what kinds of parameters you can pass to them. He also gives a few examples of scenarios when they might be useful.

2011年3月10日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Christian Schaefer's Blog: Simply iterate over XML with plain PHP using little memory and CPU


In a new post to his Test.ical.ly blog Christian Schaefer shows you how to iterate over XML in a more efficient way with the help of the XMLReader and Iterator features that come with PHP.



One of the things I have been working on lately was a simple XML parser. It's a simple XML structure in my case though it could be more complex without much change. My solution was a quite powerful yet simple combination of XMLReader and the Iterator interface.


He includes a sample XML document similar to the one he was working with and shows how XMLReader can handle it, keeping only the currently needed information in memory at one time. His sample class (CustomXml) loads the file and defines all of the iterator methods to work with the data like "next", "prev" and "rewind".

2011年3月9日星期三

Community News: Latest Releases from PHPClasses.org

php|architect: More powerful Validation from Respect


On the php|architect blog today John Mertic looks at a validation library that's been created to filter and handle user input for your application without too much effort on your part - Validation from a group called Respect.



It's simply called Validation, and it is a very simple and straightforward PHP 5.3 based validation library. The goal for them is to make validation easy and painless, using clever constructs like chaining and enabling developers to create reuseable components.


He shows a sample of how it all works by creating a validator that checks to be sure a given value is numeric. He also shows how you can chain the validation methods to create more complicated rules and even check for a set of value types (ex. numbers 1-10 or the string "NO"). You can find the code for Validate on their github repository.

2011年3月8日星期二

Community News: Latest PECL Releases for 03.08.2011

Latest PECL Releases:

Liip Blog: Recap Symfony Live Conference in Paris


On the Liip blog today there's a write up from David Buchmann about the just-passed Symfony Live conference that happened in Paris. his recap covers some of the high points of the event including sessions from the Liip-ers in the crowd.



Last week, there was the Symfony Live conference in Paris. The conference was surprisingly big, about 500 developers came together in the impressing building of Cité Universitaire Internationale. The main topic was of course the upcoming Symfony2 release. We had two days of talks and a hackday on Saturday, and lots of fun every night. The topics are on the conference website, some discussion and slides are on joind.in.


He mentions some of the "state of Symfony2" updates that were mentioned and some of the talks that were given by the Liip employees including ones on the Symfony2 CMF project, RabbitMQ and Symfony2, security and Javascript.

2011年3月7日星期一

Community News: Latest PEAR Releases for 03.07.2011

Latest PEAR Releases:

Zend Developer Zone: ZendCon Sessions Episode 041: Documents, Documents, Documents


On the Zend Developer Zone today they've published the latest episode in their ZendCon Session series (as recorded at ZendCon 2010), a talk from Matthew Weier O'Phinney about document databases - Documents, Documents, Documents.



Welcome to the ZendCon 2010 edition of the ZendCon Sessions. The ZendCon Sessions are live recordings of sessions that have been given at previous Zend Conferences. [...] In this series we will be releasing sessions from ZendCon 2010! This episode of The ZendCon Sessions was recorded live at ZendCon 2010 in Santa Clara, CA and features Matthew Weier O'Phinney giving his talk: "Documents, Documents, Documents"


You can listen in one of a few ways - either via the embedded player on the Devzone site, by grabbing the mp3 itself or by subscribing to their feed to get this and other great episodes.

2011年3月4日星期五

Site News: Popular Posts for the Week of 03.04.2011

Popular posts from PHPDeveloper.org for the past week:

Dan Scott's Blog: Creating a MARC record from scratch in PHP using File_MARC


Dan Scott has posted an example of how to create a MARC record (machine-readable cataloging, more details here) from scratch with the help of the File_MARC PEAR package.



In the past couple of days, two people have written me email essentially saying: "Dan, this File_MARC library sounds great - but I can't figure out how to create a record from scratch with it! Can you please help me? Yes, when you're dealing with MARC, you'll quickly get all weepy and get help from anyone you can.


His example code is pretty simple - load the PEAR package into the script, create the record object and start adding fields to it. He shows various output methods ("pretty print", writing the raw data to a file, etc.) and the output to various other data structures like JSON and XML.

2011年3月3日星期四

Site News: Blast from the Past - One Year Ago in PHP

Here's what was popular in the PHP community one year ago today:

Voices of the ElePHPant: Interview with Paul Jones


The Voices of the ElePHPant podcast has posted their latest episode today - an interview with Paul Jones.



Things they talk about include Paul's involvement with the Solar framework project and Cal asks him his "three questions":



  • What do you look for in a potential employer?
  • Why did you write Solar?
  • What advice do you have to Open Source projects to help foster community?


You can either listen via the in-page player or by downloading the mp3 directly.

2011年3月2日星期三

Community News: Latest Releases from PHPClasses.org

CodeIgniter Podcast: Episode #5: CodeIgniter Reactor, and Our Devious Plans


The CodeIgniter Podcast has (finally) released the next episode of their series - episode #5 where two Reactor Engineers (John Crepezzi and Kenny Katzgaru) talk about the project and some interesting recent additions.



Reposted from oconf.org, Reactor Engineers John Crepezzi and Kenny Katzgrau talk about their plans for CodeIgniter Reactor and talk about the idea of "sparks".


The sparks are self-contained, easy to install packages that bring additional functionality to the CodeIgniter core set of tools. You can either download the episode to listen or you can use the in-page player on the CodeIgniter Podcast site.

2011年3月1日星期二

Community News: Latest PECL Releases for 03.01.2011

Latest PECL Releases:

Gonzalo Ayuso's Blog: Watermarks in our images with PHP and mod_rewrite


Gonzalo Ayuso has a new tutorial posted to his site today showing how to use mod_rewrite and a little bit of PHP magic to watermark images without having to apply it to each one manually.



he idea is simple. Instead of opening directly the image, we are going to open a PHP script. This PHP script will open the original image file with imagecreatefromjpeg, add the footer and flush the new image to the browser with the properly headers.


Since it would be a lot of trouble (especially on a larger site) to have to rewrite all of the <img> tags to point to this new PHP script for adding the watermark, he opts for the .htaccess instead. It catches and rewrites the request to the "watermark.php" file which pulls in that image, watermarks it and pushes the result back out.