QRdvark Classes

MySQL Search Entire Database For Value

This small class brings some sanity to those who wish to search an entire database for a value. Quite often this is a slow process, however this class allows the search of the whole database to be limited by the datatypes. This drastically imporoves the search time by reducing the number of fields that need to be searched

Generate Barcodes With PHP

Generating barcodes with PHP is not so difficult when wrapped in a class to take out the mind numbing variations of various barcode symbologies. This class makes generation or many types of barcodes easy and reliable. This barcode generation class uses the GD library to render to a string or write to a file

Convert Fixed Width File To CSV

This class provides a quick and simple method of converting fixed width files into CSV. It makes use of the SplFileObject to do the iterations, making it very efficient as an iterator knows only the current member. Options are provided to specify the end of line character and field delimiter. This class is especially useful if data needs to come from a fixed width file, and inserted into a database, as most databases support the importation of data from CSV files.

PHP Recursive Array To XML With DOM

This class provides a method to recursively create XML from a PHP array. The functionality is provided by extending the built in Document Object Model (DOM) class. By extending the DOM class, all the functions within are available locally to the array2xml class. The main engine in this class is the createNode method, which is a recursive function that adds the child nodes to the parent root directory. The constructor takes two arguements, which are the name of the root node, and the default node_name which is applied to array elements that have a numeric index, as numeric XML tags are not permitted.

Rss Class

This class, as the name suggests, creates an RSS feed. The rss class extends the DOMDocument class that is built into PHP which enables direct access to all the functionality of the DOMElement extension. Each rss item is defined as an array and passed to the addItem method. Items include images and other elements which have sub types. The addItem method returns an instance of the class to enable method chaining as seen in the Example Usage. The rss class supports all elements from the RSS2 Specification and even includes images, skipDays, and skipHours which contain sub elements. Sub elements are simply passed as an array of values, and then added to the XML structure. The supported element names are held in a switch (see phpswitch.com) to ensure only valid RSS elements are provided, and also delegates what should happen to each valid element when declared. Invalid elements are quitly discarded as there can be no exceptions thrown when using __toString. The __toString method is provided to do away with the need for a seperate getRSS method so the object is echo\'ed directly in this example. However, it is recommended that when using this class, the output is written to a file and the file used as the point of access for rss feeds. This will save much overhead, particularly if the items are generated from a database result set.

Log Class

This class provides simple logging functionality but logging error messages to a log file. The name of the log file can be set if multiple log files need to be written for different scripts. This form of logging is a great debugging tool for those using ajax in their scripts as errors are often hidden. However, it is not just for error tracking, and can be used to record any type of events such as logins, forum posts, email sending or any place where a record needs to be maintained. The class makes use of the singleton design pattern so that the same instance of the logger class is always returned, and to provide a globally accessable method of logging.


The basics of CRUD are familiar to most PHP developers and the task of creating a factory, and a seperate class for each supported database is both time consuming and difficult to maintain. The PHP PDO toolkit provides a method of creating a CRUD class that will work across all supported databases. This example provides the basic CRUD implementation and can be built upon for further use.

Reciprocal Links

Automating recipricol links at first glance looks a daunting task. This helper class takes away much of the pain of what can be a mindlessly tedious process and simplifies it into a few easy to use class methods. Creating a list of recipricol links can now be done instantly with little fuss.

URI Class

This easy to use class takes its input from the query string in a URL and parses the parts into an array of fragments. Each fragment can be accessed with the fragment method and supplying a key. This is most useful when using urls with mod_rewrite to form urls like http://example.com/cart/category/product/item/1234.php

Validation Class

NEVER TRUST USER INPUT. This mantra is a favourite on QRdvark.com and to this end a small validation class has been provided to help validate and sanitize input from userland. The class accepts input from GET, POST, SESSION, GLOBAL, CLI or just about anywhere. The validation class provides an easy to use method of adding rules to check variables for type and length as well as structure.

Body Mass Index

This simple class calculates Body Mass Index from given height and weight variables. The class can take measurements in imperial or metric and will return a numeric index and also where that index falls on scale ranging from underweight to obese.


A Breadcrumb trail is a great tool for site navigation and provides a simple menu for users to find their back up the hierachy to Home. This method alleviates a lot of complex menu creation when navigation is left to a single menu system. The easy to follow path of a breadcrumb is very user friendly and SEO friendly for those who like to push their page rank.

SQL Syntax Highlighter

There are many pastebins that offer many forms of syntax highlighting. But if you need a simple, single purpose script to highlight SQL queries then this is it. The class will syntax highlight any SQL query and by simple substitution from an array of SQL related words.',


This class takes a PDO statement object and converts the database results into an XML string. The XML string can be used directly or written to a file for caching or other uses. By implementing SPL traversable the iterations over the database results are optimal for large result sets.

QRdvarkogle Docs

In response to the flood of responses about the QRdvarkogle class to make the creation of Google Maps with PHP simple, an API document has been produced to help speed up development time. The user docs cover all the methods and properties for making Google Maps with PHP and the QRdvarkogle class.


This is the home of the QRdvark QRdvarkogle class. This is one of the most often requests received at QRdvark.com for help with the Google Maps API. The QRdvarkogle class allows developers to create Google Maps and mashups with PHP without any need to learn javascript of the Google Maps API

Basic PHP Calendar Class

This class is provides the bare bones functionality to creating a PHP calander class. The class itself is complete but does very little and can be extended or build upon to create any type of calander solution. The dates are all gained via PHP rather than using a database so it is very portable and extensible.


Ever needed to dynaically create a HTML form from a database to add or edit data? Ever needed to map different form field types to database fields? This form generation class does all this and more and uses PDO as the database driver.