Download the PHP package 1978io/scry without Composer

On this page you can find all versions of the php package 1978io/scry. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package scry

Scry

Coarse-but-reliable User-Agent detection for PHP. One file, zero dependencies.

Scry answers four questions about a request and refuses to pretend it can answer more:

  1. Is this a real browser? — the anomaly flag
  2. Which browser family? — Chrome, Firefox, Safari, Edge, …
  3. Which OS? — Windows, macOS, iOS, Android, Linux, …
  4. Desktop, tablet or mobile?

That is the whole library. No version numbers, no device make and model, no crawler catalogue. Those things are useful, but keeping them accurate is a permanent maintenance job — which is exactly why the good libraries that do it are big. If you need that precision, use matomo/device-detector; it is excellent and Scry is not trying to replace it.

Scry is for the common case: you want to log something readable, split desktop from mobile, or notice that a "visitor" is actually curl. It is one file you can read in a sitting.


Install

Composer:

Or just drop the file in. src/Scry.php is the entire library — copy it into your project and require it. No autoloader, no vendor directory, no build step.

Requires PHP 8.0+.


Usage

Detect an arbitrary string — a stored UA from your logs, say:

The full surface

One static entry point. The returned object is immutable, and detect() never throws — an empty or nonsensical User-Agent comes back as unknown / Other with confidence() of 'low', never as a guess.

Example: a request log line


What it detects, and what it does not

It does:

It does not:

The last point is deliberate. A UA-based bot list is always out of date and anything determined to hide will just send a Chrome UA. Treat isBrowser() as a strong, cheap signal — not a security control.


Honesty notes

The friendly labels are best effort. The anomaly flag is the durable part. UA strings are self-reported and frozen by vendors; browser() and os() are convenience, and raw() is always there so you can re-parse later with something else. Nothing is thrown away.

The iPad trap. Since iPadOS 13, Safari on an iPad requests desktop sites by default and sends a User-Agent byte-identical to Safari on a Mac. Scry reports it as macOS / desktop, because that is genuinely all the string says. It does not guess "tablet" — a guess that would also mislabel every real Mac. iPads that send the mobile-mode UA (containing iPad) are correctly reported as iPadOS / tablet. If you truly need to tell them apart, that decision belongs on the client side (touch points, screen size) and should be treated as a separate signal.

confidence() describes the classification, not the visitor. 'high' means something matched positively; 'low' means Scry fell back to Other / unknown rather than invent an answer.


How it works

Everything lives in ordered data tables at the top of src/Scry.php — BROWSERS, OS, DEVICES, BOTS_AND_TOOLS — each row a [label, pattern] pair. Detection walks the tables and the first match wins, so the tables run specific to general. The ordering carries real meaning and is commented in place: Edge before Chrome (Edge's UA contains Chrome/), Chrome before Safari (Chrome's UA ends in Safari/), tablets before mobile (an Android tablet is Android without the Mobile token).

Adding a browser is a one-line addition to a table, in the right place.


Tests

The test suite is plain PHP with no dev dependencies:

The corpus in tests/run.php is the living spec — real User-Agent strings with the exact result expected for each, including the iPad trap, empty and garbage input, bots and tools, and Client-Hints cases. If you disagree with a result, open an issue against the corpus; that is the conversation worth having.


Contributing

Bug reports and additional UA corpus cases are very welcome. Pull requests that add versions, device models or a bot catalogue will be politely declined — that is not a gap in Scry, it is the design.


License

MIT — see LICENSE. Copyright © 2026 James Robinson / 1978.io.

A 1978.io project.


All versions of scry with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 1978io/scry contains the following files

Loading the files please wait ...