Yee Application Settings
mode
This is an identifier for the application's current mode of operation. The mode does not affect a Yee application's
internal functionality. Instead, the mode is only for you to optionally invoke your own code for a given mode with the
configMode()
application method.
The application mode is declared during instantiation, either as an environment variable or as an argument to the Yee application constructor. It cannot be changed during runtime. The mode may be anything you want — "development", "staging", and "production" are typical, but you are free to use anything you want (e.g. "testing").
<?php
$app = new \Yee\Yee(array(
'mode' => 'development'
));
Data Type : string
Default Value : "development"
debug
If debugging is enabled, Yee will use its built-in error handler to display diagnostic information for uncaught Exceptions. If debugging is disabled, Yee will instead invoke your custom error handler, passing it the otherwise uncaught Exception as its first and only argument.
<?php
$app = new \Yee\Yee(array(
'debug' => true
));
Data Type : boolean
Default Value : true
log.writer
Use a custom log writer to direct logged messages to the appropriate output destination. By default, Yee's logger will
write logged messages to STDERR
. If you use a custom log writer, it must implement this interface:
public write(mixed $message, int $level);
The write()
method is responsible for sending the logged message (not necessarily a string) to the appropriate output
destination (e.g. a text file, a database, or a remote web service).
To specify a custom log writer after instantiation you must access Yees's logger directly and use its setWriter()
method:
<?php
// During instantiation
$app = new \Yee\Yee(array(
'log.writer' => new \My\LogWriter()
));
// After instantiation
$log = $app->getLog();
$log->setWriter(new \My\LogWriter());
Data Type : mixed
Default Value : \Yee\LogWriter
log.level
Slim has these log levels:
- \Yee\Log::EMERGENCY
- \Yee\Log::ALERT
- \Yee\Log::CRITICAL
- \Yee\Log::ERROR
- \Yee\Log::WARN
- \Yee\Log::NOTICE
- \Yee\Log::INFO
- \Yee\Log::DEBUG
The log.level
application setting determines which logged messages will be honored and which will be ignored.
For example, if the log.level
setting is \Yee\Log::INFO
, debug messages will be ignored while info, warn,
error, and fatal messages will be logged.
To change this setting after instantiation you must access Yee's logger directly and use its setLevel()
method.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'log.level' => \Yee\Log::DEBUG
));
// After instantiation
$log = $app->getLog();
$log->setLevel(\Yee\Log::WARN);
Data Type : integer
Default Value : \Yee\Log::DEBUG
log.enabled
This enables or disables Yee's logger. To change this setting after instantiation you need to access Yee's logger
directly and use its setEnabled()
method.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'log.enabled' => true
));
// After instantiation
$log = $app->getLog();
$log->setEnabled(true);
Data Type : boolean
Default Value : true
templates.path
The relative or absolute path to the filesystem directory that contains your Yee application's template files. This path is referenced by the Yee application's View to fetch and render templates.
To change this setting after instantiation you need to access Yee's view directly and use its setTemplatesDirectory()
method.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'templates.path' => './templates'
));
// After instantiation
$view = $app->view();
$view->setTemplatesDirectory('./templates');
Data Type : string
Default Value : "./templates"
view
The View class or instance used by the Yee application. To change this setting after instantiation you need to
use the Yee application's view()
method.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'view' => new \My\View()
));
// After instantiation
$app->view(new \My\View());
Data Type : string|\Yee\View
Default Value : \Yee\View
cookies.encrypt
Determines if the Yee app should encrypt its HTTP cookies.
<?php
$app = new \Yee\Yee(array(
'cookies.encrypt' => true
));
Data Type : boolean
Default Value : false
cookies.lifetime
Determines the lifetime of HTTP cookies created by the Yee application. If this is an integer, it must be a valid
UNIX timestamp at which the cookie expires. If this is a string, it is parsed by the strtotime()
function to extrapolate
a valid UNIX timestamp at which the cookie expires.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.lifetime' => '20 minutes'
));
// After instantiation
$app->config('cookies.lifetime', '20 minutes');
Data Type : integer|string
Default Value : "20 minutes"
cookies.path
Determines the default HTTP cookie path if none is specified when invoking the Yee application's setCookie()
or
setEncryptedCookie()
methods.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.path' => '/'
));
// After instantiation
$app->config('cookies.path', '/');
Data Type : string
Default Value : "/"
cookies.domain
Determines the default HTTP cookie domain if none specified when invoking the Yee application's setCookie()
or
setEncryptedCookie()
methods.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.domain' => 'domain.com'
));
// After instantiation
$app->config('cookies.domain', 'domain.com');
Data Type : string
Default Value : null
cookies.secure
Determines whether or not cookies are delivered only via HTTPS. You may override this setting when invoking
the Yee application's setCookie()
or setEncryptedCookie()
methods.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.secure' => false
));
// After instantiation
$app->config('cookies.secure', false);
Data Type : boolean
Default Value : false
cookies.httponly
Determines whether cookies should be accessible through client side scripts (false = accessible). You may override this setting when invoking
the Yee application's setCookie()
or setEncryptedCookie()
methods.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.httponly' => false
));
// After instantiation
$app->config('cookies.httponly', false);
Data Type : boolean
Default Value : false
cookies.secret_key
The secret key used for cookie encryption. You should change this setting if you use encrypted HTTP cookies in your Yee application.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.secret_key' => 'secret'
));
// After instantiation
$app->config('cookies.secret_key', 'secret');
Data Type : string
Default Value : "CHANGE_ME"
cookies.cipher
The mcrypt cipher used for HTTP cookie encryption. See available ciphers.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.cipher' => MCRYPT_RIJNDAEL_256
));
// After instantiation
$app->config('cookies.cipher', MCRYPT_RIJNDAEL_256);
Data Type : integer
Default Value : MCRYPT_RIJNDAEL_256
cookies.cipher_mode
The mcrypt cipher mode used for HTTP cookie encryption. See available cipher modes.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'cookies.cipher_mode' => MCRYPT_MODE_CBC
));
// After instantiation
$app->config('cookies.cipher_mode', MCRYPT_MODE_CBC);
Data Type : integer
Default Value : MCRYPT_MODE_CBC
http.version
By default, Yee returns an HTTP/1.1 response to the client. Use this setting if you need to return an HTTP/1.0 response. This is useful if you use PHPFog or an nginx server configuration where you communicate with backend proxies rather than directly with the HTTP client.
<?php
// During instantiation
$app = new \Yee\Yee(array(
'http.version' => '1.1'
));
// After instantiation
$app->config('http.version', '1.1');
Data Type : string
Default Value : "1.1"