Load the data classes
package |
Default |
---|
string
The name of the class to load
Load the media classes
package |
Default |
---|
string
The name of the class to load
Load the network classes
package |
Default |
---|
string
The name of the class to load
Load the system classes
package |
Default |
---|
string
The name of the class to load
PVObject is an extendable class used to enhance an object that can be instantiated.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
$example = new Example();
$example->foo='bar';
echo $example-> foo;
//Add a dynamic method
$example -> addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo $example -> fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call the instance and the attached observer
$example->testMe('Testing String ');
PVAudio is a class designed to manipulate audio files and transcoding to various formats.
PVAudio works with all kinds of audio files: mp3, wave, real audio, etc. It utilizes command tools like FFMPEG to do the transcoding and will return the results from the command line.
Example:
//Set the file to be converted
$old_file = '/path/to/file/audio.wav';
//Set the path of the new file
$new_file = '/path/to/file/audio.mp3';
//Options to pass to the FFmpeg or other conversion tools
//The following will place a -f infront of the input
$options = array('input_f' => '');
//Run the conversion
PVAudio::init();
PVAudio::convertAudioFile($old_file, $new_file , $options );
PVBootstrap is responsible for initializing the system the system by initializing all the classes.
This class will have to be refactored, but it was designed to give base options for creating a secure environment based off of a configuration file that would be passed to it.
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:
//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);
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.
The PVCollection class acts as a repository for data to be stored, retrieved and iterated over.
The collection class is a simple way of storing and getting information with key, value pairs, Any information can be stored and retrieved including strings, array, and objects. Some example use cases:
//Add data and increment over fit
$collection = new PVCollection();
$collection -> add('Apples');
$collection -> add('Oranges');
foreach($collection as $key => $value) {
echo $value;
}
PVCommunicator opens up communication with other services via Curl, SOAP, or Sockets.
With the rise of RESTFUL API and Microservices, this class was designed to allow easy communication with those services without having to rewrite the underlying commands.
Example:
//CURL GET
$url = 'http://api.wunderground.com/api/Your_Key/conditions/q/CA/San_Francisco.json';
$communicator = new PVCommunicator();
$communicator->send('get', $url);
print_r($communicator ->getResponseBody());
//CURL POST
$url = 'http://api.example.com/createuser';
$data = array('name' =>'John Doe', 'email' => 'johndoe@example.com')
$communicator = new PVCommunicator();
$communicator->send('POST', $url, );
print_r($communicator ->getResponseBody());
The PVConfiguration acts a global registry for system-wide configuration options for the application.
The configuration class is most notably used for setting variables that can be retrieved anywhere in your system with the setters and getters. There is also the option of setting different environment.
Example:
//Init the class
PVConfiguration::init();
//Add An Example Configuration
$data = array(
'host'=>'localhost',
'database' => 'test',
'user'=>'admin',
'password'=>'abc123'
);
PVConfiguration::addConfiguration('mysql', $data);
//Retrieve and use that configuration
$mysql = PVConfiguration::getConfiguration('mysql');
echo $mysql->host;
//Set different configs for different environments
PVConfiguration::addConfiguration('mysql', $data, array('environment' => 'production'));
PVConversions is a class used to convert one data type to another.
Often there will be requirements for converting data such as array to objects, json to xml, etc. This class is designed to have built-in functions to make those conversations easy.
Example:
//Create an array
$data = $array('Apple', 'Bananna', 'Orange');
//Convert the array to object
$data = PVConversions::arrayToObject($data);
//Will display an stdObject
print_r($data);
PVDatabase controls the connections to various databases ranging from Mysql to MongoDB.
For future development, the class needs to be written, but it offers a lot of powerful features that including prepared statements, schema manipulation, sanitization, and other features.
Example:
//Initialize the class
PVDatabase::init();
//Two Different Configurations
$mysql_options = array(
'dbhost' => 'localhost',
'dbuser' => 'jondoe',
'dbpass'=>'abc123',
'dbtype'=>'mysql',
'dbname'=>'example1',
'dbport'=>3306
);
//Add The Connection
PVDatabase::addConnection('connection1', $mysql_options);
$postgres_options = array(
'dbhost' => 'localhost',
'dbuser' => 'janedoe',
'dbpass'=>'doeraeme',
'dbtype'=>'postgresql',
'dbname'=>'example2',
'dbport'=>5432
);
//Add The Connection
PVDatabase::addConnection('connection2', $postgres_options);
//Connect To the Mysql Database
PVDatabase::setDatabase('connection1');
//Sanitize input
$value = PVDatabase::makeSafe('SELECT ItemName, ItemDescription FROM Items WHERE ItemNumber = 999; DROP TABLE USERS ');
//Execute A Query
PVDatabase::query("INSERT INTO users(name) VALUES(${value})");
//Change the Database connection
PVDatabase::setDatabase('connection2');
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.
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!');
PVForms is a class that controls the creation and management of HTML form elements.
The class can be tied in with other systems for creating of forms that can be generated by passing in dynamic elements.
Example:
//Create Input Element
echo PVForms::creatInput('name', 'text');
//Create An Input with Bootstrap Element
echo PVForms::creatInput('name', 'text', array('class' => 'form-control'));
//Complete Form
echo PVForms::formBegin('my-form', array('method' => 'post', 'enctype' => 'multipart/form-data'));
echo PVForms::creatInput('name', 'text', array('class' => 'form-control', 'value' => 'My Name', 'placeholder' => 'Enter your name'));
echo PVForms::button('enter', array('type' => 'submit', 'class' => 'btn btn-success'));
echo formEnd();
PVHTML is a class designed for generating HTML elements to display to the user.
The class takes in basic HTML forms with options. The functionality can be used with dynamic form generation tools.
Example:
//Create array of links
$links = array('Google', 'http://www.google.com', 'Facebook', 'http://www.facebook.com');
$html = '';
$li = '';
foreach($links as $key => $value):
$li .= PVHtml::li(PVHtml::ahref($key, $value));
endforeach;
$html = PVHtml::ul($li);
$html = PVHtml::div($html, array('class' => 'container'));
echo $html;
//The following will be printed
<div class="container">
<ul>
<li><a href="http://www.google.com">Google</a><li>
<li><a href="http://www.facebook.com">Facebook</a><li>
</ul>
</div>
PVImage is a class for handling the processing and format of all image files.
PVImage has various functions built into it such as adding watermarks, resizing, cropping and more. By default, the class will use Imagick but can be set to use other image processing tools.
PVLibraries is designed to load external libraries into the system, especially those that are not in a management service like Composer.
While tools like composer make including and accessing libraries easy, not every library is on the service nor does every project want to manage their 3rd parties libraries in the same way. PVLibraries primary focus is the loading of external libraries to be used in your application.
Example:
//Initialize the class
PVLibraries::init();
//Add an external library
PVLibraries::addLibrary('MailLoader', array('path' => '/absolute/path/to/library/1', 'explicit_load' => true));
//Add a library with name spaces
PVLibraries::addLibrary('Facebook', array('path' => '/absolute/path/to/library/2', 'namespaced' => true));
//To your application to load these libraries for use
PVLibraries::loadLibraries();
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:
//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');
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:
//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'
));
PVMathematics is a class for doing computations.
The class is relatively incomplete and could use more important functions to ease development.
PVObject is an extendable class used to enhance an object that can be instantiated.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
$example = new Example();
$example->foo='bar';
echo $example-> foo;
//Add a dynamic method
$example -> addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo $example -> fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call the instance and the attached observer
$example->testMe('Testing String ');
PVPatterns is the parent class for implementing Adapters, Observers, Intercepting Filters and Singletons on instances.
Prodgiyview comes with 4 design patterns that can be extended to any object: Adapters, Observers, Intercepting Filters and Singletons. By extending this class to any object that can be instantiated, they will have the capability of using these design patterns.
PVRequest is responsible for receiving and parsing income HTTP requests.
Built for receiving communication from other sources, PVRequest has the ability to take a request, parse the headers, get the data, determine what kind of requests, and other features.
Example:
$request = new PVRequest();
if($request -> isAjaxRequest()) {
echo "AJAX REQUEST\n";
}
if(strtolower($request -> getRequestMethod()) =='post') {
echo "A Post Request was send\n";
}
$data = getRequestData();
print_r($data);
PVResponse is responsible for sending HTTP responses back to a client.
The class takes into consideration the many generic responses HTTP has ranging from 200 to 500, and helps make it easy to output the correct response with headers.
Example:
//Init the class
PVResponse::init();
//Successful Response
PVResponse::createResponse(200, 'Hello Word!');
//Page Not Found
PVResponse::createResponse(404, 'The page you are looking for cannot be found');
PVRouter is responsible for parsing the URL setting up the ability for routing within your application.
Applications, especially with Frontend Controller Design Pattern, may require routing to get a user to their destination correctly. This class can take rules, route and correctly navigate the user to their destination.
PVSecurity is a class designed to handle the security of your application ranging from encryption to hashing.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public static function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
Example::set('foo','bar');
echo Example::get('foo');
//Add a dynamic method
Example::addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo Example::fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call test me and the observer attached
Example::testMe('Testing String ');
PVSession is the class for handling the cookie session information related to the system.
The class offers a variety of tools for how to set up basic session control within your application. These features can be used in conjunction with other session handling methodologies.
Example:
//Initialize the class
PVSession::init();
//Write data to a cookie
PVSession::writeCookie('foo', 'bar');
echo PVSession::readCookie('foo');
//Encrypt the value
PVSession::writeCookie('foo', 'bar', array('hash_cookie' => true));
echo PVSession::readCookie('foo', array('hash_cookie' => true);
PVStaticObjectt is an extendable class used to enhance an object with static methods.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public static function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
Example::set('foo','bar');
echo Example::get('foo');
//Add a dynamic method
Example::addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo Example::fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call test me and the observer attached
Example::testMe('Testing String ');
PVPatterns is the parent class for implementing Adapters, Observers, Intercepting Filters and Singletons on static methods.
Prodgiyview comes with 4 design patterns that can be extended to any object: Adapters, Observers, Intercepting Filters and Singletons. By extending this class to any object that uses static methods, they will have the capability of using these design patterns.
PVStaticObjectt is an extendable class used to enhance an object with static methods.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public static function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
Example::set('foo','bar');
echo Example::get('foo');
//Add a dynamic method
Example::addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo Example::fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call test me and the observer attached
Example::testMe('Testing String ');
PVPatterns is the parent class for implementing Adapters, Observers, Intercepting Filters and Singletons on static methods.
Prodgiyview comes with 4 design patterns that can be extended to any object: Adapters, Observers, Intercepting Filters and Singletons. By extending this class to any object that uses static methods, they will have the capability of using these design patterns.
PVTemplate is a generic template wrapper class that is used as a basis for creating a templating system.
ProdigyView comes with the ability to implement adapters, intercepting filters and observers. Extending this class to a child class will give the child class the ability to use those design patterns along with a collection that can assign and retrieve values using magic functions.
Example:
//Create the class
class Example extends PVObject {
public static function testMe($string) {
echo $string;
//An observer
$this->_notify(get_class() . '::' . __FUNCTION__, $string);
}
}
//Add to its collection
Example::set('foo','bar');
echo Example::get('foo');
//Add a dynamic method
Example::addMethod('fiz', function($text) {
return 'fiz ' . $text;
});
echo Example::fizz('Bop');
//Add Observer
Example::addObserver('Example::testMe', 'test_closure', function($string) {
echo "\nLine 2 \n"
echo $string;
}, array('type' => 'closure'));
//Will call test me and the observer attached
Example::testMe('Testing String ');
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:
//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);
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:
//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';
}
PVVideo is a class designed to manipulate video files and transcoding to various formats.
PVVideo works with all kinds of audio files: mp4, mov, ogg, etc. It utilizes command tools like FFMPEG to do the transcoding and will return the results from the command line.
Example:
//Set the file to be converted
$old_file = '/path/to/file/video.mov';
//Set the path of the new file
$new_file = '/path/to/file/video.mp4';
//Options to pass to the FFmpeg or other conversion tools
//The following will place a -f infront of the input
$options = array('input_f' => '');
//Run the conversion
PVVideo::init();
PVVideo::convertAudioFile($old_file, $new_file , $options );