Download the PHP package wickedbyte/tombstone without Composer

On this page you can find all versions of the php package wickedbyte/tombstone. 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 tombstone

Tombstone

This library includes a variety of ways handling tombstone hits in your codebase, including handlers that trigger PHP errors (e.g. E_USER_DEPRECATED), use the local filesystem to track tombstone hits, and drop-in integrations for your project's existing PSR-3 Logger, PSR-14 Event Dispatcher, PSR-6/PSR-16 Cache implementations.

Installation & Configuration

Install as a non-development dependency with Composer:

Somewhere in your project's bootstrap process or service container (e.g. via a service provider), configure a new GraveyardConfiguration instance, and pass it to the Graveyard::config() method. For example:

If, for some reason, a tombstone is hit before the configuration is set, the library will default to a fallback configuration that will log the tombstone hit as a PHP E_USER_DEPRECATED error.

The GraveyardConfiguration class accepts the following named arguments:

Usage

To mark a location in your code as a tombstone, use the tombstone function:

Alternatively, you can use the Graveyard::tombstone() static method directly:

Both methods accept an arbitrary string message argument. The message should be brief, and may include a date or other information about when or why the code tombstone was added. The message will be logged when the tombstone is hit, and is used as part of the tombstone's unique identifier. This means that if you can add more granularity by making the message string dynamic.

The second parameter, $extra, is an optional array of additional context information that can be used by your custom helper implementations. For example, if you add a handler that sends an email notification, you can use the $extra array to include the email address of the person who added the tombstone and the recipient address.

Tombstone Handlers

Included Tombstone Handlers

InMemoryRateLimitHandler

While code that is assumed to already be dead will probably not be hit frequently, it's better to be safe than sorry, especially when paying for production log storage.

To reduce spamming logs and other side effects when a tombstone is hit in a loop or at high-frequency, this handler will limit the number of tombstone hits that are logged to one-per-request. More accurately -- important for non-HTTP contexts, like queue workers and cron-jobs -- one-per-instantiation of the configured handler class. The underlying array is a key/value pairing of the tombstone's 8-byte identifier and the value true, in order to minimize memory usage.

PhpErrorHandler

This handler will trigger a PHP error when a tombstone is hit, allowing your project's error handling system to log the tombstone hit as it would any other PHP error. By default, the error level is E_USER_DEPRECATED, but the other three runtime user error levels (E_USER_ERROR, E_USER_WARNING and E_USER_NOTICE) are also supported.

FilesystemGraveyardHandler

This handler uses the local filesystem to track tombstone hits. Provide it with a directory path (it can create the directory if it does not exist) and tombstone activations will be logged to a file in that directory, one per tombstone ID. You will need to manually clear the directory if you want to reset the tombstone. We only touch the file if it does not already exist.

PsrLoggerHandler

This handler will log tombstone hits to a PSR-3 logger instance, e.g. Monolog. The default log level is warning, but can be configured with any of the PSR-3 log levels. The handler will log additional context information about the tombstone hit, including the tombstone's message, the stack trace, and contextual information for the current request.

PsrEventDispatcherHandler

This handler integrates with your existing PSR-14 Event Dispatcher, and dispatches the TombstoneActivated event. This allows you to add additional listeners to the event, that do not have to implement the TombstoneHandlerInterface interface, and are defined along with the rest of your project's event listeners.

PsrCacheHandler / PsrSimpleCacheHandler

These handlers will cache tombstone hits using a PSR-6 or PSR-16 cache instance. If the cache implementation uses some kind of remote driver like Redis or Memcached, this can be useful for tracking tombstone hits across multiple servers or processes. The cache key is the tombstone's unique identifier, and the value is either the TombstoneActivated instance or 1. The latter is much more memory and bandwidth efficient, but does not include the tombstone's message or stack trace, which might be useful for debugging, just how a tombstone was hit, and by whom.

The default cache TTL is 86400 seconds (24 hours), but can be configured to any non-negative integer value. If the TTL is set to 0, the cache will never expire -- you probably do not want that, though it is technically allowed.

Creating Custom Tombstone Handlers

To create a custom handler, implement the TombstoneHandlerInterface interface:

Then add an instance of your custom handler to the GraveyardConfiguration instance. Handlers can be dynamically added or reset at runtime by calling the Graveyard::config()->pushHandlers() or Graveyard::config()->setHandlers() methods.

If you want to stop the propagation of the tombstone event to other handlers, set the $propagate property of the passed in TombstoneActivated instance to false.

Contributing

Run make to build the project Docker image, create the "./build" cache directory and install vendor dependencies with Composer.

To upgrade the project dependencies to their current major versions, run make upgrade, or to just update them within the bounds of their currently defined constraints, run make update

Common Actions with Makefile targets:

To get a fresh start, run make clean to delete the vendor and build directories, which will trigger a docker image rebuild, the next time make is run.

For anything else not defined in the Makefile, use:


All versions of tombstone with dependencies

PHP Build Version
Package Version
Requires php Version 8.2.* || 8.3.*
psr/cache Version ^1.0 || ^2.0 || ^3.0
psr/event-dispatcher Version ^1.0
psr/log Version ^1.0 || ^2.0 || ^3.0
psr/simple-cache Version ^1.0 || ^2.0 || ^3.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 wickedbyte/tombstone contains the following files

Loading the files please wait ....