\DeviceAtlas\DeviceConfig

DeviceApi Configurations. To change the default configs of the DeviceAtlas DeviceApi create an instance of this class, set your preferred configs and pass the instance to the constructor of a DeviceApi. Note that you may change the configs even after the Config instance has been passed to the DeviceApi.

Summary

Methods
Properties
Constants
setCookieName()
getCookieName()
setMaxCacheEntries()
getMaxCacheEntries()
setUseTreeOptimizer()
getUseTreeOptimizer()
setOptimizerTempDir()
getOptimizerTempDir()
setCacheProvider()
getCacheProvider()
setIgnoreDataFileChanges()
getIgnoreDataFileChanges()
No public properties found
DEFAULT_COOKIE_NAME
DEFAULT_MAX_CACHE_ENTRIES
No protected methods found
No protected properties found
N/A
No private methods found
$cookieName
$maxCacheEntries
$useTreeOptimizer
$ignoreDataFileChanges
$optimizerTempDir
$cacheProvider
N/A

Constants

DEFAULT_MAX_CACHE_ENTRIES

DEFAULT_MAX_CACHE_ENTRIES = 4096

The default config value for result (Properties object) caching. Depending on the frequency and distance factor of your user-agents or headers passed to the API for detection the result cache may increase performance by preventing repeated lookups.

Properties

$cookieName

$cookieName : 

Type

$maxCacheEntries

$maxCacheEntries : 

Type

$useTreeOptimizer

$useTreeOptimizer : 

Type

$ignoreDataFileChanges

$ignoreDataFileChanges : 

Type

$optimizerTempDir

$optimizerTempDir : 

Type

$cacheProvider

$cacheProvider : 

Type

Methods

setCookieName()

setCookieName(string  $cookieName) 

To change the cookie name that the client side properties would be set to.

When using getProperties() in a web application, the detection would automatically use the contents of this cookie if it exists. If you want the client side properties to be used add the DeviceAtlas client side component (JS lib) to your web-site pages.

When the user-agent or HTTP headers are set manually to getProperties() the client side properties (probably the value set to the cookie) can be manually passed to this methods as the second argument, note that this config is only used for getProperties(REQUEST-OBJECT). If you set the cookie-name to null then the client-side properties cookie will be ignored.

Parameters

string $cookieName

The cookie name which the client side properties are set to. Set to null to turn off using client-side properties

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getCookieName()

getCookieName() : string

Get the cookie name that the client side properties would be set to.

When using getProperties() in a web application, the detection would automatically use the contents of this cookie if it exists. If you want the client side properties to be used add the DeviceAtlas client side component (JS lib) to your web-site pages.

When the user-agent or HTTP headers are set manually to getProperties() the client side properties (probably the value set to the cookie) can be manually passed to this methods as the second argument, note that this config is only used for getProperties(REQUEST-OBJECT).

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

string —

The cookie name which the client side properties are set to

setMaxCacheEntries()

setMaxCacheEntries(  $maxCacheEntries) 

Set the max number of results to be cached. Depending on the frequency and distance factor of your User-Agents or headers passed to the API for detection, increasing the result cache may increase performance by preventing repeated lookups. For a large set of inputs (i.e. an almost unique set of user-agents) set to lower numbers or 0 to disable.

Parameters

$maxCacheEntries
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getMaxCacheEntries()

getMaxCacheEntries() : integer

Get the max number of results to be cached.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

integer

setUseTreeOptimizer()

setUseTreeOptimizer(boolean  $useTreeOptimizer) 

To optimize data. Optimizing the data file will dramatically reduce the memory foot print and data file loading speed. It is highly recommend to turn this config on when detecting devices in real-time using DeviceAtlasWeb.<br/> When this config is on, the API will automatically divide the data file into smaller pieces and cache them on the disk, the cached data will be used for lookups afterwards. The API detects data file updates and will update the cache.

Parameters

boolean $useTreeOptimizer

true=turn on data optimizer (by default this config is off for DeviceApi but on for DeviceApiWeb)

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getUseTreeOptimizer()

getUseTreeOptimizer() : boolean

To get data optimization status. Optimizing the data file will dramatically reduce the memory foot print and data file loading speed. It is highly recommend to turn this config on when detecting devices in real-time using DeviceAtlasWeb.<br/> When this config is on, the API will automatically divide the data file into smaller pieces and cache them on the disk, the cached data will be used for lookups afterwards. The API detects data file updates and will update the cache.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

boolean —

true=data optimizer is on

setOptimizerTempDir()

setOptimizerTempDir(string  $optimizerTempDir) 

When optimizer is turned on, the cached files will be put inside the system directory by default, you can change the default optimizer temp/cache directory with this method.

Parameters

string $optimizerTempDir

path to temp directory

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getOptimizerTempDir()

getOptimizerTempDir() : string

Get the temp directory path in which the optimizer puts the cached files.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

string —

path to the optimizer temp directory

setCacheProvider()

setCacheProvider(\DeviceAtlas\Device\Cache  $cacheProvider) 

Set a cache provider to the API to cache the lookup results. This will dramatically increase the lookup performance in most situations. It is highly recommend to use this config when detecting devices in real-time using DeviceAtlasWeb.

Parameters

\DeviceAtlas\Device\Cache $cacheProvider

a cache provider instance

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getCacheProvider()

getCacheProvider() : \DeviceAtlas\Device\Cache

Get the cache provider instance being used by the API to cache the lookup results.

null is returned when a cache provider is not used.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

Returns

\DeviceAtlas\Device\Cache

a cache provider instance or null

setIgnoreDataFileChanges()

setIgnoreDataFileChanges(boolean  $ignoreDataFileChanges) 

When data file optimizer is set to true using the "setUseTreeOptimizer()" config, the API will try to use a batch of optimized cached files instead of the original data file, the API will do several checks to pick between the cached data file or the passed data file. While this makes the API automatically sense and update the cached files.

Parameters

boolean $ignoreDataFileChanges
Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275

getIgnoreDataFileChanges()

getIgnoreDataFileChanges() 

Get if the data file optimizer should do data file update automatic checking.

Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275 Warning: count(): Parameter must be an array or an object that implements Countable in /opt/phpdoc/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275