> For the complete documentation index, see [llms.txt](https://exiang.gitbook.io/yeebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://exiang.gitbook.io/yeebase/others/yeebase-functions.md).

# YeeBase Functions

### isUnixTimeStamp

Return true if string is a valid unix timestamp, false if not.&#x20;

### createProxyUrl

`YeeBase::createProxyUrl($controller, $urlPart, $urlParams)`

Create a 'Proxy URL' that can bypass cloudflare. This is a workaround to some of the cloudflare limitation such as timeout and max POST limit. It uses config `Yii::app()->params['noProxyUrl']` to build the URL string.

### clearCache

`YeeBase::clearCache($cacheId = '')`

Clear cache either by specific cache ID or flush the entire cache

### modelErrors2String

`YeeBase::modelErrors2String($model->getErrors())`

Return  form model errors in a string representation (which originally an array). This is handy like in situation you need to throw exception message.

### configVar2value

`YeeBase::configVar2value($var, $yamlItem)`

### parseStrSelect

`YeeBase::parseStrSelect($string, $selector)`

### runPOpen

`YeeBase::runPOpen($command, $pathOutput, $forceRewrite = true, $echo = false)`

### getVersion

`YeeBase::getVersion()`

Return the application version with value like '1.1.2.4614'. It's a combination of `.version` and `.build` file in `/public_html/`

### getVersionWithoutBuild()

`YeeBase::getVersionWithoutBuild()`

Return the application version without the build version, value like '1.1.2'. It takes value from`.version` file in `/public_html/.`

### **getControllersInPath**

`YeeBase::getControllersInPath($path, $withPostfixController = true)`

To get the list of controllers by specific file path. `$path` is the full path to the directory. e.g.: `/var/www/open_hub/protected/controllers`

`getControllersInPath('/var/www/open_hub/protected/controllers')`

```php
Array
(
    [0] => BackendController
    [1] => CategoryController
    [2] => FrontendController
    [3] => GeofocusController
    [4] => ResourceController
    [5] => TestController
)
```

`getControllersInPath('/var/www/open_hub/protected/controllers', false)`

```php
Array
(
    [0] => backend
    [1] => category
    [2] => frontend
    [3] => geofocus
    [4] => resource
    [5] => test
)
```

### **getActionsInController**

`YeeBase::getActionsInController($controllerName, $moduleKey = '', $withPrefixAction = true)`

This will return a list of actions name inside a controller which belongs to base or module.

`YeeBase::getActionsInController('TestController', 'boilerplateStart')`

```php
Array
(
    [0] => actionBoilerplateStartOrganizationBehavior
    [1] => actionIndex
)
```

`YeeBase::getActionsInController('TestController', 'boilerplateStart', false)`

```php
Array
(
    [0] => boilerplateStartOrganizationBehavior
    [1] => index
)
```

`YeeBase::getActionsInController('SiteController')`

```php
Array
(
    [0] => actionIndex
    [1] => actionWelcome
    [2] => actionAbout
    ...
)
```

### **getActionsInControllerPath**

`YeeBase::getActionsInControllerPath($controllerFilePath, $withPrefixAction = true)`

Use this to get the list of actions name (without prefix `action`) by specific controller file path. `$controllerFilePath` is the full path to the controller. e.g.: `/var/www/open_hub/protected/controllers/SiteController.php`

### roleCheckerAction

`YeeBase::roleCheckerAction($role, $controller, $action = '')`

To check whether role is allowed to access the route / action

### beginProfile

`YeeBase::beginProfile($code)`

Auto check  with config`Yii::app()->params['enableProfileLog']` internally.

### endProfile

`YeeBase::endProfile($code)`

Auto check  with config`Yii::app()->params['enableProfileLog']` internally.

### jsonEncode

`YeeBase::jsonEncode($array, $flags = 0, $depth = 512)`

Use this function to encode array to json will make sure any charset entry will be converted to utf-8 first, hence prevent return null issue if other charset passed it. it required the none default mbstring module to be enabled.

### jsonDecode

`YeeBase::jsonDecode($array, $associative = null, $depth = 512, $flags = 0)`
