Application

Class Lib\Application

Introduction

This class is useful for retrieving information about the current application, namely:

  • his name
  • his language
  • his unique key (useful for the X-AP-Key header)
  • his version used
  • the sdk version used by the device

Methods

getConf

<?php public static function \Lib\Application::getInstance(string $encoding = 'utf8')

Description
Method that creates the unique instance of the class if it does not already exist and then returns it.

getPath

<?php public static function getPath()

Description
Return the absolute path of the application.

Return
A string representing the path.

get

<?php  public function get(string $prop = '')

Description
Return the value of a property.

Parameters

  • prop : Possible values : name, key, lang, version, sdk_version

Return
A string representing the path.


Examples

Retrieve the language of the user and display a text from the Text Manager in his language.

<?php

$lang = \Lib\Application::getInstance()->get('lang');
$message = \Lib\TextManager::translate("welcome_message", $lang);

echo $message;