Setup
Install
Installing Nephtali on a server running PHP >= 5.3 is straight forward and takes a couple minutes. Nephtali works by turning on output buffering for PHP pages and setting the auto_append value for PHP pages in the site to the ncore.php file of Nephtali.
- Download Nephtali and unzip archive.
- Upload the file setup.php to your public directory of your website.
- View setup.php in your web browser (e.g., http://yourwebsite.com/setup.php) and follow the instructions.
- Delete the setup.php files (one in public directory and other in nsite directory) from your server once you've tested your installation.
Upgrade
- Download Nephtali and unzip archive.
- Replace the file nephtali/ncore.php on your server with the new ncore.php file.
Configure
Nephtali uses one lone configuration file, nephtali/nconfig.php. The file contains a function, which accepts 4 arguments:
- mode, the current mode of the Nephtali site. Options include 'dev', 'test', 'prod'.
- dev, the array of values available for the development environment.
- test, the array of values available for the test environment.
- prod, the array of values available for the production environment.
The Nephtali download includes a dummy config file with dummy data. You can add any values you'd like within any of the environment arrays. Once a value is set in nconfig.php, it is immutable, and it can be retrieved with the function n\config\get('value_name')
Setting the config mode on a page-by-page basis
You can set the mode for a particular page by adding one line of code to the top of your markup file:
<?php $nephtali_config_mode = 'prod'; ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
One potential issue with the above feature is that developers could forget they'd added the Nephtali mode declaration to a page, unknowingly leaking debug information to the site's users.
To address this potential issue, the Nephtali mode declaration only has effect when you add a fifth argument to the n\config\save(), as seen below:
n\config\save(
$mode = 'dev',
$dev = array(
// settings
),
$test = array(
// settings
),
$prod = array(
// settings
),
$allow_page_overrides = true
);
This allows the developer to ensure that the config mode for the site is enforced site-wide by removing the $allow_page_overrides argument (defaults to FALSE.)
blog comments powered by DisqusPotential gotchas
- Remember to append the Nephtali settings (whether you're using php.ini -or- .htaccess) to any existing settings.
- Some servers configured with .htaccess files require that you nest the php settings within IfModule tags such as below:
<IfModule php5_module> #settings here <IfModule>