Classes, interfaces and traits

PVCache

PVCache is a system for caching data and retrieving cached data.

The default system uses a file cache for caching data. But the system through the adapter pattern is extendable to use any caching system attached to the application. Example: ```php //Init The Cache PVCache::init(); $data = array('Apples', 'Oranges', 'Bananas'); //Check if cache has expired if(PVCache::hasExpired('mycache')): //Store The Cache PVCache::writeCache('mycache', $data); endif; $data = PVCache::readCache('mycache'); print_r($data); ```
« More »

PVCli

Command Line Interface (CLI) utility class.

This is an adaptation of Patrick Fisher command line parser for PHP. The class has been modified to utilizes adapters, filter and observers natively present in ProdigyView.
« More »

PVFileManager

PVFileManager allows easy manipulation of the file system such as making directories or getting mime types.

The class has various functions that make file manipulation reasonably easy. ```php Examples: //Count the number of files in a directory echo PVFileManager::getFilesInDirectory('/path/to/directry'); //Get Mime Type echo PVFileManager::getFileMimeType('image.jpg'); //Write To File PVFileManager::getFileMimeType('/path/to/file', 'Hello World!'); ```
« More »

PVLog

PVLog is used to write information to a log for record keeping.

The logs that can be recorded is up to the developer. The class can be overridden with Adapters to do things like write to syslog or external logging services. Example: ```php //Initialize The class PVLog::init(); //Write various logs with different priority levels PVLog::writeLog('Warning', 'Illegal Access By User'); PVLog::writeLog('High Alert', 'System Almost Out Of Memory'); PVLog::writeLog('Low', 'Page Not Found'); //Get the logs with a high priority level $logs = PVLog::readLog('High Alert'); ```
« More »

PVMail

PVMail is responsible for sending email from the application.

PVMail is a basic class for sending emails. The class either uses the default mail() function on the server, or can be configured to send emails via SMTP. Example: ```php //Initialize The Class PVMail::init(array( 'smtp_host' => 'external.example.com', 'smtp_username' => 'MyLogin', 'smtp_password' => 'abc123', 'smtp_port' => 582, 'mailer' => 'smtp', 'default_sender' => 'mydomain@example.com' )); //Send An Email PVMail::sendEmail(array( 'receiver' => 'jane@example.com', 'sender'=>'jon@example.com', 'subject'=>'Hello World' 'message'=>'Dropping a line, saying hello' )); ```
« More »

PVMathematics

PVMathematics is a class for doing computations.

The class is relatively incomplete and could use more important functions to ease development.
« More »

PVTools

PVTools is a class that has random tools to be utilized in an application.

The tools in this class do not have a direct affiliation with any other class and can be considered more of general tools. Example: ```php //Create random string of capital letters A -F that is 10 letters long $string = PVTools::generateRandomString( 10, $chars = 'ABCDEF'); //Search a recursive array $data = array( 'fruits' => array('Strawberries', 'Oranges') 'vegetables' => array('celery', 'salad'), 'meat' => array( 'white' => array('chicken', 'turkey'), 'red' => array('beef', 'goat') ) ); $item = PVTools::arraySearchRecursive('turkey', $data); ```
« More »

PVValidator

PVValidator is a dynamically extendable class used to validate inputs.

The class can be used to check for a variety of inputs to validate data from mime types to correct syntax for a URL. The class is also extendable to add more validation rules. Examples: ```php //Check if a file is an integer if(PVValidator::check('integer', '3.4')) { echo 'I am an integer'; } if(PVValidator::check('url', 'http://www.google.com')) { echo 'I am a valid url'; } //Add custom validation rule PVValidator::addRule('is_currency', array('function' => function($number) { return preg_match("/^-?[0-9]+(?:\.[0-9]{1,2})?$/", $number); })); //Check against custom rule if(PVValidator::check(‘is_currecny’, '$10.00')) { echo 'I am currency'; } ```
« More »