-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathxap.bootstrap.php
43 lines (34 loc) · 1.44 KB
/
xap.bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Xap bootstrap
*/
// import Xap engine
require_once './lib/Xap/Engine.php';
// import Xap Model class (if using '/model' query option)
// require_once './lib/Xap/Model.php';
// import Xap Decorate class (if using decorators)
// require_once './lib/Xap/Decorate.php';
// import Xap Cache class (if using '/cache' query option for caching)
// require_once './lib/Xap/Cache.php';
// import xap() function
require_once './lib/Xap/xap.php';
// register database connection
xap([
// database connection params
'host' => 'localhost',
'database' => 'test',
'user' => 'myuser',
'password' => 'mypass',
// 'id' => 1, // manually set connection ID (default 1)
// 'errors' => false, // display errors (default true)
// 'debug' => false, // debug messages and errors to log (default true)
// 'objects' => false, // return objects instead of arrays (default true)
// 'error_handler' => null, // optional error handler (callable)
// 'log_handler' => null // optional log handler (callable)
]);
// set global pagination records per page (default 10) + current page number
// xap(':pagination', ['rpp' => 10, 'page' => isset($_GET['pg']) ? (int)$_GET['pg'] : 1]);
// set global cache settings
// \Xap\Cache::setExpireGlobal('10 seconds'); // global cache expire time (default '30 seconds')
// \Xap\Cache::setPath('/var/www/app/cache'); // global cache directory path
// \Xap\Cache::$use_compression = false; // disable cache file compression (enabled by default)