PHP Classes Innovation Award 2009-05
The PHP Programming Innovation Award goal is to provide recognition to developers who make outstanding contributions to the PHP community. The award aims to honor developers who share components in the form of PHP classes of objects that provide innovative features or solve problems with approaches that provide additional value to the PHP applications of other developers.
1. PDF to JPG (Flip book), by Satish Kumar
PDF is a very popular format for distributing documents that are ready to be printed. Displaying PDF documents on a site, depends on the availability of browser plug-ins or external programs installed on the user machine. This class provides a solution for extracting images of the pages of a PDF document, so it can be browsed on a Web site without depending on having the right plug-ins or programs installed in the user browser.
Detailed description:
- This class can be used to convert PDF documents to JPEG images using ImageMagick.
- It uses ImageMagick convert tool and Ghostscript to generate JPEG images from given PDF files. The resulting images are stored in separate directory.
- The class also generates ZIP archive with a the images and XML file in the Flip book format
2. Array to Object converter, by Sebastian Potasiak
Since PHP 5, classes can be used to access objects as if they were arrays. This class takes advantage of that possibility to quickly initialize object variables from data taken from associative arrays.
Detailed description:
- This class can be used to turn any array into an object.
- It takes an array and assigns the variables of the class with the values of the array entries with the same name.
- Array entries with array values are also converted to objects recursively.
3. MP3 Class, by mfboy
MPEG is a standard format for storing video and audio streams. MPEG 1 audio layer 3, also known as MP3, is a very popular way for storing compressed audio streams in MPEG format. This package allows parsing and manipulating MPEG frames that can be used to build MP3 audio manipulation applications in PHP.
Detailed description:
- This class can be used to manipulate MP3 audio files.
- It can open an MP3 audio file and parse it to retrieve information about the data in its frames.
- The class can also change and delete frames of the MP3 audio file and save the results to a separate file.
4. Image Booth, by Abbey Sparrow
Photoshop is a very popular program that allows editing images that are composed of several layers of independent images. This package implements a solution that allows editing complex images made of layers to which can be applied several types of image editing operations.
Detailed description:
- This class can be used to manipulate images split in layers.
- It can create images that are composed of several independent layers.
- The class can apply different effects separately to the images in the different layers or to all layers at once like resizing the canvas.
- Separate classes are available which implement different types of operations like Gaussian blur, threshold, grayscale, line detection, gradient detection, laplacian filter, Sobel filter, color replacement, brightness/contrast, photonegative and rotation (and not GD’s terrible rotate) with plenty more coming.
- In the end it can merge the image layers in a single image that is saved to a file or served as the current script output in any format supported by the GD extension.
5. Dijkstra, by Xu Yulei
Dijkstra algorithm is very popular to determine the best path to route packets of information sent over the Internet, but it can be used to the determine the best path to go through any type of network. This class provides a pure PHP implementation of the Dijkstra algorithm
Detailed description:
- This class can be used to find the best route between two points using the Dijkstra algorithm.
- It takes as parameters an array with all possible routes between to points and the start point.
- The class can get the best path and the distance to each network point.
6. Overload, by Ralf Mike Pretzlaw
Overloading is a feature built-in in some Object Oriented languages like C++. It allows calling a class function with the same name but is implemented in multiple ways depending on the number and type of parameters that are passed to a function. Currently PHP does not provide built-in functionality to provide overload support exactly like in C++. There is an overload extension in PECL but it is not exactly the same thing. This class provides overload functionality emulation using PHP 5 magic methods.
Detailed description:
- This class implements class function overloading.
- It is a base class that allows sub-classes to have functions that may be called in several ways using with a different number of arguments or arguments with different types.
- The base class intercept calls to the overloaded functions and dispatches those calls according to the types and number of arguments.
7. jsCheck, by Gustav Eklundh
Some sites implement features that depend on Javascript libraries or embeddable elements that need Javascript to properly integrate them on the page. However, sometimes Javascript support is disabled on the browser for some reason. This class provides a solution to detect whether Javascript is enabled on the browser, so the applications can display alternative content or show messages to tell the user that enabling Javascript support is necessary.
Detailed description:
- This class can be used to check whether Javascript is enabled in the browser.
- It can generate a HTML form with Javascript to automatically submit it when the page is load.
- The class can set cookies or session variables to avoid the need to generate the form to check again if the browser has Javascript enabled.
8. PHP Git, by Cesar D. Rodas
GIT is a modern revision control system that is used by developers to maintain different revisions of project files. This package provides a pure PHP solution to access project files maintained in a GIT repository.
Detailed description:
- This package can be used to manipulate project files from GIT repositories.
- It can retrieve files from local and remote Git repositories via HTTP.
- It can also retrieve file revision history, repository tags, get the list of a files with a given commit identifier or project tags, get the differences between a given commit identifier and the previous, checkout files with a given commit identifier, and clone a repository.
9. CSP Filter, by Michael A. Peters
When displaying HTML content submitted to a site by untrusted users, you need to be careful to not allow cross-site scripting and cross-site request forgery security exploits that can be performed by specially crafted HTML and Javascript. Mozilla foundation people have defined a Content Security Policy that defines which HTML elements can be or not be included in a page. This class can filter untrusted HTML using Mozilla Content Security Policy rules.
Detailed description:
- This class can be used to filter HTML based on Content Security Policy.
- It takes a DOM Document object loaded with the structure of an HTML document and process it to find violations of the Content Security Policy definition.
- The class changes the document structure to filter and enforce the policy definitions, so the application can serve a compliant HTML document.
10. untiny, by James Hinds
URL shortening sites became very popular again, thanks mainly to the Twitter phenomenon. The problem of using shortened URLs is that users do not know in advance where exactly the links point. This class provides a simple solution to determine the redirection URL regardless of the short URL service that is used.
Detailed description:
- This class can be used to determine the pages where short URLs lead.
- It accesses the page of a given short URL and checks if it redirects to another URL.
- The class returns the final URL if the initial URL redirects to another page.
11. TypeSafeStruct, by Tom Schaefer
PHP 5 provides type hinting support that allows verifying the types of values passed to class function parameters, but it only supports checking parameters that expect object or array parameters. This package provides an alternative solution for checking parameters of setter functions for many other types of values. It is based on the name of function that is called.
Detailed description:
- A Case Study for getting PHP type safe.
- This package can be used to manipulate type safe objects in a way that works with PHP caching extensions.
- It provides base classes that can check whether the types of the values to assign variables of implementation subclasses are of the expected types.
- The expected types are determined by the prefixes of private variables, so it works well even when using PHP compiled code cached extensions.
- An additional class can serialize objects as XML documents or to insert them in database tables.
Comments Off