Environments
OverivewObjectiveLearn how to set different environments in theconfiguration file.Requirements Understanding of the confi...
Follow Along With A Code          Example1. Download a copy of the example code at  www.prodigyview.com/source.2. Install ...
EnvironmentsEnvironments are a specified configuration to use basedon the current system environment.In ProdigyView, confi...
Setting up Connections    To start this tutorial, we are going to set up to database    connections, one for development a...
Add Configuration    Once we have our configurations set up, we can add    them with an environment set. Every configurati...
Retrieving Environment              VariablesOnce the environments are saved, they can be retrievedby calling the environm...
Setting Our Default                    EnvironmentOur next step is to set the default environment. There are many ways to ...
ConfigurationNow it’s time for initializing the configuration class with ourenvironment. This will create a default enviro...
Retrieving Our ConfigurationThe last step is retrieving the configuration. Because weset the environment in the initializa...
Review1. Set a configuration with   PVConfiguration::addConfiguration method.2. Retrieve a set configuration using   PVCon...
More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials                     www.prodigyview.com
Upcoming SlideShare
Loading in …5
×

PHP Environments

914 views

Published on

Learn how to customize environments in ProdigyView.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
914
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

PHP Environments

  1. 1. Environments
  2. 2. OverivewObjectiveLearn how to set different environments in theconfiguration file.Requirements Understanding of the configuration fileEstimated Time7 minutes http://www.prodigyview.com
  3. 3. Follow Along With A Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/system/Environments.php http://www.prodigyview.com
  4. 4. EnvironmentsEnvironments are a specified configuration to use basedon the current system environment.In ProdigyView, configurations can be set to certainenvironments. An example of usage is having differentdatabase connections used based upon the server beingused.When you understand how to set up environments, youcan also begin to use them in other areas, such asconfigurations based upon a user. http://www.prodigyview.com
  5. 5. Setting up Connections To start this tutorial, we are going to set up to database connections, one for development and one for production.1. Production Connection2. Development Connection
  6. 6. Add Configuration Once we have our configurations set up, we can add them with an environment set. Every configuration as a key used for saving and accessing the data.1. Configuration key 2. Data associated with key 3. Environment
  7. 7. Retrieving Environment VariablesOnce the environments are saved, they can be retrievedby calling the environment it was saved as. 1. Key used to save the environment 2. Environment
  8. 8. Setting Our Default EnvironmentOur next step is to set the default environment. There are many ways to the setserver environment. $_SERVER[‘ENV’] $_SERVER[‘SERVER_NAME’] In NGINX and FastCGI, you can set a custom variable in the fastcgi_params In Apache, you can set a custom environment variable in the htaccess fileIn our example, we are going to use the HTTP_HOST to decide our environment.
  9. 9. ConfigurationNow it’s time for initializing the configuration class with ourenvironment. This will create a default environment whenadding and retrieving configurations. Initialize with environment
  10. 10. Retrieving Our ConfigurationThe last step is retrieving the configuration. Because weset the environment in the initialization, we no longer needto specify it when retrieving the configuration. Retrieve configuration with only the key
  11. 11. Review1. Set a configuration with PVConfiguration::addConfiguration method.2. Retrieve a set configuration using PVConfiguration::getConfiguration method.3. An environment can be explicitly set when adding and retrieving configurations.4. Setting an environment in PVConfiguration::init will create a default environment in which you will no longer need a explicitly set the environment when adding or retrieving data. http://www.prodigyview.com
  12. 12. More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com

×