HOW TO INSTALL ParamsProxy DEMO ------------------------------- Contents: 1. What is ParamsProxy 2. What the demo does 3. Installing the demo 4. License 5. Author 6. Version 1. ParamsProxy is a PHP class that provides a generic configuration mechanism using XML files. You can use ParamsProxy to provide a simple method of configuring your next PHP library, or to adapt an existing one, with minium of change. Please consult the includded documentation before using ParamsProxy: ./assets/ParamsProxy.html. 2. This demo provides a sample PHP class, ./ParamsProxyDemo.php, and a sample configuration file, ./assets/config.xml. You will use the configuration file to configure the PHP class; the class is only roughly sketched, as it only prints on screen the values set in the configuration file. 3. a) Gathering required dependencies i. the ParamsProxy class requires the DOMIT! XML parsing library by John Heinstein; ii. the ParamsProxyDemo class requires the ParamsProxy class. In this demo, all required files are placed under the ./assets folder, but in real life scenarios you'll want to provide better grouping to your libraries, especially for large projects. For now, just include needed files by placing this code in ParamsProxyDemo.php: require_once ('assets/domit/xml_domit_include.php'); require_once ('assets/ParamsProxy.php'); b) Declaring the class Before you can configure a PHP class using ParamsProxy, you must hook that class' instance to the ParamsProxy's singleton instance. Open the ParamsProxyDemo.php file and add this code to its constructor method: // Hook up this class to the proxy: ParamsProxy::getInstance()->configure($this); c) Configuration folder Before being able to use the ParamsProxy class, you must setup a configuration folder. All configuration files will live in here, each placed under a sub-folder with the same name as the name of the class to be configured. Under Unix, create this folder: /home/MyConfig Under Windows, create this folder: C:\MyConfig Open the file ./assets/ParamsProxy_config.xml and fill in the path of the folder just created, e.g.: <value>/home/MyConfig/</value> d) Configuration file You will allways write your configuration directives in a file named config.xml. You place this file, under the configuration folder, in a sub-folder with the same name as the name of the class to be configured. i. change into /home/MyConfig (on Unix) or C:\MyConfig (on Windows); ii. create sub-folder ParamsProxyDemo iii. change into just created sub-folder iv. copy provided file ./assets/config.xml as /home/MyConfig/ParamsProxyDemo/config.xml (on Unix) or as C:\MyConfig\ParamsProxyDemo\config.xml (on Windows) e) Completing instalation Point your browser to the ParamsProxyDemo.php file. If you have correctly installed ParamsProxy, you should see four table collecting information from your configuration file. Change some value in your configuration file and reload the ParamsProxyDemo.php page in your browser. You should see the corresponding value changing. For any new PHP class that you want to configure using ParamsProxy, you'll only need to repeat steps d) trough e). Of course, you'll need to adapt the config.xml file accordingly. 4. Both this demo and the ParamsProxy class are licensed under the Creative Commons Attribution Share Alike license. You should have received a full copy of this license as ./assets/Creative Commons Attribution Share Alike.txt. The full license body is also available online, at http://creativecommons.org/licenses/by-sa/3.0/legalcode. 5. The ParamsProxy class has been written and is being maintained by Claudius Tiberiu Iacob. You can reach me at email@example.com 6. You're holding version 1.5a (alpha) of ParamsProxy. Please note that API and functionality are subject to change in future versions. Send all bugs to firstname.lastname@example.org, thank you.