A simple class to highlight HTML with PHP. This class is not as fully featured as others, however, gets the job done in a lot less lines of code. Enjoy!
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
This PHP FTP class provides an easy to use wrapper for many common FTP functions with PHP.
This class makes the creation of secure passwords with SALT easy and also provides a method to check passwords. The class uses PBKDF2 to create the salt and password which eliminates the threat from hackers using rainbow tables etc.
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
This class provides the functionality to encrypt and decrypt a text string. The class makes use of the PHP mcrypt extension which provides the ability to create two way encryption, or decoding of text messages.
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.
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.
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.
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.
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.
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
NEVER TRUST USER INPUT. This mantra is a favourite on PHPRO.ORG 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.
This simple and easy to use class has a single purpose, to fetch the zodiac star sign of a given month and day. Great for anybody wishing to display astrological data on a website
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.
For those who wish easy access to Yahoo stock reports to add to a website or perhaps to insert into a database, this simple class provides a clean object oriented interface to getting the quotes for stocks from Yahoo Finance.
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.
In response to the flood of responses about the phproogle 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 phproogle 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.
Due to the unprecedented amount of emails recieved for support for this class, a seperate documentation page has been created to deal with issues as they arise.
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.
For those who need a simple and efficent method of templating and caching this class bundles all the goodness into one and provides much flexibility with low complexity.
PhPro is happy to introduce a new section on classes. this is not a tutorial on Object Oriented Programming but a collection of classes we have put together to enable rapid development within a OO model