PHPackages                             scientiamobile/wurflcloud - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. scientiamobile/wurflcloud

AbandonedArchivedLibrary[API Development](/categories/api)

scientiamobile/wurflcloud
=========================

ScientiaMobile PHP WURFL Cloud Client

v2.2.0(6y ago)5100.0k↓38.4%4GPL-2.0-or-laterPHPPHP &gt;=5.3.0

Since May 20Pushed 1y ago11 watchersCompare

[ Source](https://github.com/WURFL/wurfl-cloud-client-php)[ Packagist](https://packagist.org/packages/scientiamobile/wurflcloud)[ RSS](/packages/scientiamobile-wurflcloud/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (13)Used By (0)

ScientiaMobile WURFL Cloud Client for PHP
=========================================

[](#scientiamobile-wurfl-cloud-client-for-php)

WURFL Cloud Deprecation Notice
------------------------------

[](#wurfl-cloud-deprecation-notice)

As of Q3 2023, WURFL Cloud and its associated client libraries for all programming languages have been officially deprecated and decommissioned. No further updates, including security fixes, will be provided. Continued use of WURFL Cloud or its clients is strongly discouraged and may expose you to security risks, and continued usage is at your own risk.

We strongly urge all users to migrate to [WURFL Microservice](https://scientiamobile.com/wurfl-microservice/) or another [supported WURFL device detection solution](https://scientiamobile.com/product-selection-tool/) as soon as possible. For guidance on alternative products and pricing, please [contact ScientiaMobile](https://scientiamobile.com/contact-us/).

Thank you for your understanding and continued support.

---

The WURFL Cloud Service by ScientiaMobile, Inc., is a cloud-based mobile device detection service that can quickly and accurately detect over 500 capabilities of visiting devices. It can differentiate between portable mobile devices, desktop devices, SmartTVs and any other types of devices that have a web browser.

This is the PHP Client for accessing the WURFL Cloud Service, and it requires a free or paid WURFL Cloud account from ScientiaMobile:

Installation
------------

[](#installation)

---

### Requirements

[](#requirements)

- `PHP 5.3+` (Some HTTP adapters may require 5.4+)
- `json` extension (almost always included)
- `curl` extension is recommended

### Sign up for WURFL Cloud

[](#sign-up-for-wurfl-cloud)

First, you must go to  and signup for a free or paid WURFL Cloud account (see above). When you've finished creating your account, and have selected the WURFL Capabilities that you would like to use, you must copy your API Key, as it will be needed in the Client.

### Via Composer

[](#via-composer)

```
composer require scientiamobile/wurflcloud

```

### Via Source

[](#via-source)

[Download the source code](https://github.com/WURFL/wurfl-cloud-client-php/zipball/master)

```
require_once '/path/to/cloud/client/src/autoload.php';

```

### Example WURFL Cloud Client

[](#example-wurfl-cloud-client)

From your web browser, you should go to the WURFL Cloud Client's examples/ folder. You will see the Compatibility Test Script, which will verify that your configuration is compatible with the WURFL Cloud Client.

You should test your API Key from this page by pasting it in the input box, then clicking "Test API Key". If successful, you will see "Your server is able to access WURFL Cloud and your API Key was accepted." If there was a problem, the error message will be displayed instead. Please note that it may take a few minutes from the time that you signup for your WURFL Cloud API Key to become active.

### Integration

[](#integration)

You should review the included examples (`example.php`, `MyWurfl.php`, `show_capabilities.php`) to get a feel for the Client API, and how best to use it in your application.

Here's a quick example of how to get up and running quickly:

```
// Include the autoloader - edit this path!
require_once '../src/autoload.php';
// Create a configuration object
$config = new ScientiaMobile\WurflCloud\Config();
// Set your WURFL Cloud API Key
$config->api_key = 'xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Create the WURFL Cloud Client
$client = new ScientiaMobile\WurflCloud\Client($config);
// Detect your device
$client->detectDevice();
// Use the capabilities
if ($client->getDeviceCapability('is_wireless_device')) {
    echo "This is a mobile device";
} else {
    echo "This is a desktop device";
}
```

### Upgrading from v1.x

[](#upgrading-from-v1x)

---

**IMPORTANT**: Since version 2.0.0, the WURFL Cloud Client for PHP uses namespaces. In addition, things were moved around a bit to allow for easier configuration.

To upgrade your existing v1 code, you will need to replace calls to the following classes:

```
old:
require_once '../Client/Client.php';
WurflCloud_Client_Config
WurflCloud_Client_Client
WurflCloud_Cache_Null
WurflCloud_Cache_Cookie

new:
require_once '../src/autoload.php';
ScientiaMobile\WurflCloud\Config
ScientiaMobile\WurflCloud\Client
ScientiaMobile\WurflCloud\Cache\NullCache
ScientiaMobile\WurflCloud\Cache\Cookie

```

Every other class was also renamed/namespaced, so if you are using them directly, you can follow the mapping above to figure out the new name.

If you were using the `MyWurfl.php` singleton, you can use the new one and no code changes will be required in your application.

Note that in v2, support for proxy servers was added as well as better support for timeouts. More on these options is found below.

Configuration
-------------

[](#configuration)

---

The WURFL Cloud Client object `ScientiaMobile\WurflCloud\Client` takes three arguments: `Config`, `Cache`, `HttpClient`.

### Config

[](#config)

`ScientiaMobile\WurflCloud\Config`
Used for setting the WURFL Cloud API Key `api_key` and adding `addCloudServer()` / removing `clearServers()` WURFL Cloud Servers.

### Cache (optional)

[](#cache-optional)

Caching classes:

- `ScientiaMobile\WurflCloud\Cache\NullCache`: Disables caching completely
- `ScientiaMobile\WurflCloud\Cache\Cookie`: Cookie-based caching
- `ScientiaMobile\WurflCloud\Cache\File`: Filesystem-based caching
- `ScientiaMobile\WurflCloud\Cache\APC`: APC (or APCu) memory-based caching
- `ScientiaMobile\WurflCloud\Cache\Memcache`: Memcached distributed memory-based caching using the PHP `memcache` extension
- `ScientiaMobile\WurflCloud\Cache\Memcached`: Memcached distributed memory-based caching using the PHP `memcached` extension

### HttpClient (optional)

[](#httpclient--optional)

- `ScientiaMobile\WurflCloud\HttpClient\Fsock`: Uses native PHP `fsock` calls
- `ScientiaMobile\WurflCloud\HttpClient\FileGetContents`: Uses native PHP `file_get_contents` calls
- `ScientiaMobile\WurflCloud\HttpClient\Curl`: Uses the PHP extension `curl`
- `ScientiaMobile\WurflCloud\HttpClient\Guzzle`: Uses the [Guzzle HTTP client (version &lt; 4)](http://guzzlephp.org/)
- `ScientiaMobile\WurflCloud\HttpClient\GuzzleHttp`: Uses the [Guzzle HTTP client (version 6+)](http://guzzlephp.org/)

Note: to use `Guzzle` or `GuzzleHttp`, you must have the Guzzle library loaded. To load it locally, you can run the following command from the root of the WURFL Cloud Client folder:

```
composer update

```

Then make sure to use the composer autoloader `vendor/autoload.php` instead of the built in one (`src/sutoload.php`).

#### Proxy Server Configuration

[](#proxy-server-configuration)

The `FileGetContents`, `Curl`, `Guzzle` and `GuzzleHttp` HTTP Clients support a proxy server configuration via the `setProxy()` method:

```
// Common proxy examples
$http_client = new ScientiaMobile\WurflCloud\HttpClient\Curl();

// Socks 4 Proxy
$http_client->setProxy("socks4://192.168.1.1:1080");

// Socks 4a Proxy
$http_client->setProxy("socks4a://192.168.1.1:1080");

// Socks 5 Proxy
$http_client->setProxy("socks5://192.168.1.1:1080");

// Socks 5 Proxy + Authentication
$http_client->setProxy("socks5://someuser:somepass@192.168.1.1:1080");

// HTTP Proxy
$http_client->setProxy("http://192.168.1.1:8080");

// HTTP Proxy + Authentication
$http_client->setProxy("http://someuser:somepass@192.168.1.1:8080");

// Pass $http_client in to the Client to use it
$client = new ScientiaMobile\WurflCloud\Client($config, $cache, $http_client);
```

#### HTTP Timeout

[](#http-timeout)

The WURFL Cloud Client is set to forcefully terminate the WURFL Cloud request after 1 second if a response has not been received. In some cases you may want to increase this timeout to account for high latency. All of the HTTP Clients support the `setTimeout()` method:

```
$http_client = new ScientiaMobile\WurflCloud\HttpClient\Curl();

// Timeout is in milliseconds (10000 == 10 seconds)
$http_client->setTimeout(10000);

// Pass $http_client in to the Client to use it
$client = new ScientiaMobile\WurflCloud\Client($config, $cache, $http_client);
```

### Google App Engine

[](#google-app-engine)

---

In order to use the WURFL Cloud Client in a Google App Engine PHP application, you may need to make some changes to the default configuration.

First, you should use the `FileGetContents` HTTP Client since `curl` and `fsock` are not supported by default.

```
$http_client = new ScientiaMobile\WurflCloud\HttpClient\FileGetContents();
```

Next, you should use either `Memcache` or `File` for caching:

Memcache:

```
$cache = new ScientiaMobile\WurflCloud\Cache\Memcache();
```

File:

```
$cache = new ScientiaMobile\WurflCloud\Cache\File();

// Disable UNIX hard links since they aren't supported in Google App Engine
$cache->use_links = false;

// Update this to point to your Google Cloud Storage bucket
$cache->cache_dir = "gs://bucket_name/";
```

Putting this all together, the following is a fully functional Google App Engine config (using `Memcache`):

```
// Create a configuration object
$config = new ScientiaMobile\WurflCloud\Config();

// Set your WURFL Cloud API Key
$config->api_key = 'xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// Create the cache adapter
$cache = new ScientiaMobile\WurflCloud\Cache\Memcache();

// Create the HttpClient adapter
$http_client = new ScientiaMobile\WurflCloud\HttpClient\FileGetContents();

// Create the WURFL Cloud Client
$client = new ScientiaMobile\WurflCloud\Client($config, $cache, $http_client);

// Detect device
$client->detectDevice();
```

Unit Testing
============

[](#unit-testing)

Unit tests are included with the client and can be run with PHPUnit. Before you can run the unit tests, you must install the dependencies via Composer from the root directory:

```
cd WurflCloudClient-PHP*
curl -sS https://getcomposer.org/installer | php
php composer.phar install

```

Before you run the PHPUnit tests, you must set your WURFL Cloud API Key in an environment variable so it can be used in the tests. To run the tests, run `phpunit` from the root directory (where `phpunit.xml.dist`is located):

```
export WURFL_CLOUD_API_KEY="123456:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
php vendor/bin/phpunit -v

```

You can also use the Docker image included in `tests/docker` to run the test suite as follows:

```
cd tests/docker
export WURFL_CLOUD_API_KEY="123456:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
docker-compose up

```

Note that in order to get all the tests to pass, you will need to use the API Key from a Premium WURFL Cloud account with all capabilities enabled. This is because small responses from the WURFL Cloud system are never compressed if they fit within one network packet, and the unit tests that cover compression see this as a failure. If this is the case, you will see failures like this:

```
There were 3 failures:

1) ScientiaMobile\WurflCloud\HttpClient\CurlTest::testCallCompression
Failed asserting that an array contains 'Content-Encoding: gzip'.

2) ScientiaMobile\WurflCloud\HttpClient\FsockTest::testCallCompression
Failed asserting that an array contains 'Content-Encoding: gzip'.

3) ScientiaMobile\WurflCloud\HttpClient\GuzzleTest::testCallCompression
Failed asserting that an array contains 'Content-Encoding: gzip'.

```

You will also need to have the extensions `apc`, `memcache`, `memcached`, `json`, and `curl` enabled. By default, `apc` is not enabled in CLI mode, so you may need to launch phpunit like this to force it on:

```
php -d apc.enable_cli=1 vendor/phpunit/phpunit/phpunit.php -v

```

**2016 ScientiaMobile Incorporated**

**All Rights Reserved.**

**NOTICE**: All information contained herein is, and remains the property of ScientiaMobile Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to ScientiaMobile Incorporated and its suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from ScientiaMobile Incorporated.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 51.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~196 days

Recently: every ~241 days

Total

9

Last Release

2441d ago

PHP version history (2 changes)v2.0.2PHP &gt;=5.4.0

v2.0.3PHP &gt;=5.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/266265?v=4)[Steve Kamerman](/maintainers/kamermans)[@kamermans](https://github.com/kamermans)

![](https://www.gravatar.com/avatar/bf90d98ab17cec652893ade7ce8202952a9ee2c3c6ea531d558dd581bbd9bcdb?d=identicon)[lucor](/maintainers/lucor)

![](https://www.gravatar.com/avatar/963e8317c929e5a4b8f263850d39b9d5326ec905bec7e844daa6d213d22e1f84?d=identicon)[scientiamobile](/maintainers/scientiamobile)

---

Top Contributors

[![kamermans](https://avatars.githubusercontent.com/u/266265?v=4)](https://github.com/kamermans "kamermans (23 commits)")[![lucor](https://avatars.githubusercontent.com/u/313577?v=4)](https://github.com/lucor "lucor (9 commits)")[![elliotfehr](https://avatars.githubusercontent.com/u/5550991?v=4)](https://github.com/elliotfehr "elliotfehr (6 commits)")[![exussum12](https://avatars.githubusercontent.com/u/1102850?v=4)](https://github.com/exussum12 "exussum12 (3 commits)")[![sriram-sridharan](https://avatars.githubusercontent.com/u/1398571?v=4)](https://github.com/sriram-sridharan "sriram-sridharan (3 commits)")[![tobiasbeckert](https://avatars.githubusercontent.com/u/25172980?v=4)](https://github.com/tobiasbeckert "tobiasbeckert (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scientiamobile-wurflcloud/health.svg)

```
[![Health](https://phpackages.com/badges/scientiamobile-wurflcloud/health.svg)](https://phpackages.com/packages/scientiamobile-wurflcloud)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
