51degrees / fiftyone.devicedetection
Device detection engines for 51Degrees Pipeline API. Parse HTTP headers to detect hardware, operating system, browser, and crawler information.
Installs: 9 336
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 2
Open Issues: 0
Requires
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.39
- phpstan/phpstan: ^1.10
- phpunit/phpunit: *
- dev-main
- 4.5.4.0
- 4.5.3.0
- 4.5.2.0
- 4.5.1.0
- 4.5.0.0
- 4.4.29.0
- 4.4.28.0
- 4.4.27.0
- 4.4.26.0
- 4.4.25.0
- 4.4.24.0
- 4.4.23.0
- 4.4.22.0
- 4.4.21.0
- 4.4.20.0
- 4.4.19.0
- 4.4.18.0
- 4.4.17.0
- 4.4.16.0
- 4.4.15.0
- 4.4.14.0
- 4.4.13.0
- 4.4.12.0
- 4.4.11.0
- 4.4.10.0
- 4.4.9.0
- 4.4.8.0
- 4.4.7.0
- 4.4.6.0
- 4.4.5.0
- 4.4.4.0
- 4.4.3.0
- 4.4.2
- 4.4.1
- 4.4.0
- 4.3.7
- 4.3.6
- 4.3.4
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.2+4
- 4.2.1+4
- 4.2.0
- 4.1.0
- 4.1.0-beta.14+1
- 4.1.0-beta.13+1
- v4.1.0-beta0012
- v4.1.0-beta0005
- v4.1.0-beta0003
- dev-copyright-update
This package is auto-updated.
Last update: 2024-12-16 21:04:31 UTC
README
Introduction
This project contains the source code for the PHP implementation of 51Degrees' cloud-based device detection engine for use with the Pipeline API.
Dependencies
The tested versions page shows the PHP versions that we currently test against. The software may run fine against other versions, but additional caution should be applied.
You will require a resource key to use the Cloud API. You can create resource keys using our configurator, see our documentation on how to use this.
Examples
Note: Examples run on Linux and macOS. We don't test on Windows environments as it is a rare choice for PHP.
To run the examples, you will need PHP and composer installed. Once these are available, install (or update) the dependencies required by the examples. Navigate to the repository root and execute:
composer install
or
composer update
if dependencies were install previously.
This will create the vendor directory containing autoload.php.
Ensure the resource_key
environment variable is set to your resource key prior to running the example scripts.
Now navigate to the examples directory and start a PHP server with the relevant file.
For example:
resource_key=YOUR_RESOURCE_KEY php -S localhost:3000 cloud/gettingStartedWeb.php
or to run in a terminal
resource_key=YOUR_RESOURCE_KEY php cloud/gettingStartedConsole.php
This will start a local web server listening on port 3000. Open your web browser and browse to http://localhost:3000/ to see the example in action.
The table below describes the examples that are available.
Tests
This repo has tests for the examples. To run the tests, make sure PHPUnit is installed then, in the root of this repo, call:
phpunit --fail-on-warning --display-warnings --log-junit test-results.xml
On-premise device detection
The on-premise implementation of device detection is much faster but requires more memory and processing power than the cloud version. Unfortunately, distributing the on-premise package via composer would require the inclusion of binary executables (.so/.dll) that are not permitted. If you wish to use the on-premise version then you will need to clone the on-premise repository and follow the instructions in the readme to build the required modules. This is a fairly involved process so feel free to contact us if you are having difficulties.
Development
When making changes to this repository, it may be necessary to link to a local development version of pipeline dependencies. For information on this, see Composer local path.
For exmaple, if a development version of 51degrees/fiftyone.pipeline.core
was stored locally, the location would be added with:
"repositories": [
{
"type": "path",
"url": "../../path/to/packages/pipeline-php-core"
}
]
then the dependency changed to:
"51degrees/fiftyone.pipeline.core": "*"