Classes, interfaces and traits

PVBootstrap

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.
« More »

PVConfiguration

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: ```php //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')); ```
« More »

PVDatabase

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: ```php //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'); ```
« More »

PVLibraries

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: ```php //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(); ```
« More »

PVSecurity

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. ```php 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 '); ```
« More »

PVSession

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: ```php //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); ```
« More »