Download the PHP package dockcodes/dock-thor without Composer

On this page you can find all versions of the php package dockcodes/dock-thor. 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?
dockcodes/dock-thor
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package dock-thor

DockTHOR PHP SDK

Framework-agnostic PHP client for DockTHOR. It reports uncaught exceptions, PHP errors and HTTP transactions to a DockTHOR project.

Framework bridges build on this package and are shipped separately: dock-thor-laravel, dock-thor-symfony, dock-thor-drupal, dock-thor-joomla and the dockthor WordPress plugin.

Installation

Requires PHP 8.2 or newer.

Configuration

A project is identified by two values taken from the DockTHOR panel:

Value Where it goes Secret
project token path of the ingest URL no
private key Authorization: Bearer header yes

token, private_key and url also default to the THOR_TOKEN, THOR_PRIVATE_KEY and THOR_URL server variables, so a deployment can configure the SDK without touching code. When either credential is missing the SDK stays loaded but sends nothing — it never throws for being unconfigured.

Options worth knowing

Option Default Meaning
url https://thor.dock.codes DockTHOR instance to report to
environment null shown as the environment column in the panel
release null version of the deployed application
error_types error_reporting() which PHP errors become events
sample_rate 1.0 share of error events that get sent
traces_sample_rate 0.0 share of transactions that get sent; 0 disables tracing
send_default_pii false attaches user id, e-mail, IP and user agent
enable_compression true gzips the request body
send_after_response true on web, false on CLI queues events and sends them after the response
max_request_body_size medium none, small, medium or always
in_app_exclude [] paths whose frames are marked as vendor code
before_send identity last chance to modify or drop an event

Reporting

Uncaught exceptions and fatal errors are captured automatically by the default integrations; pass 'default_integrations' => false to opt out.

When events are sent

By default the SDK reports after the response. Events are queued during the request and delivered from a shutdown handler, once PHP-FPM or LiteSpeed has closed the connection to the browser. A slow or unreachable panel then costs the visitor nothing.

Where the SAPI cannot close the connection early (mod_php), the queue is still flushed at shutdown, so reporting never happens in the middle of handling a request.

The queue holds at most 50 events per request; beyond that new events are dropped, since the panel counts repeats by fingerprint anyway. Set 'send_after_response' => false to send inline — the default is already false under CLI, where a long-running worker should not hold reports until the process ends.

Transactions

A transaction measures one HTTP request. The panel needs the request URL, the method and the response status, so the SDK ships a helper that fills all three:

Transactions are only sent when traces_sample_rate is above zero.

Browser errors

A browser cannot authenticate against the panel: the private key would have to sit in page source. The SDK therefore ships the collector script and the server-side normaliser, and the application in the middle does the reporting:

fromArray() returns null for anything it cannot make an event of, and truncates every string it keeps. Guard the endpoint yourself — a CSRF token, a body size limit and a per-IP rate limit are what the shipped plugins use.

The collector caps itself as well: one report per distinct error per page view, ten per page view by default, with ResizeObserver loop and cross-origin Script error. filtered out.

Writing a bridge for another framework

Every bridge does the same four things, and the SDK has a seam for each:

  1. Boot — call init() (or build a client with ClientBuilder) as early as the framework allows, so errors raised during bootstrap are still reported.
  2. Report — hand the framework's exception handler to captureException(). Frameworks with a PSR-3 logger can instead register Monolog\Handler or any LoggerInterface decorator that forwards to the hub.
  3. Trace — wrap request handling in Framework\HttpTransaction.
  4. Enrich — set the user and tags on the scope, and mark framework code as vendor code through in_app_exclude so stack traces point at the application.

Anything the framework knows better than the SDK — how to read the current request, who the current user is, where the application root lives — is passed in through options and the scope. Nothing in Dock\Thor reaches back into a framework.

License

MIT. See LICENSE.


All versions of dock-thor with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-mbstring Version *
guzzlehttp/promises Version ^1.0|^2.0
jean85/pretty-package-versions Version ^2.0.4
nyholm/psr7 Version ^1.8
nyholm/psr7-server Version ^1.1
php-http/client-common Version ^2.7
php-http/discovery Version ^1.19
php-http/httplug Version ^2.4
psr/http-factory Version ^1.0
psr/log Version ^1.0|^2.0|^3.0
symfony/http-client Version ^5.4|^6.0|^7.0
symfony/options-resolver Version ^5.4|^6.0|^7.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 dockcodes/dock-thor contains the following files

Loading the files please wait ...