Download the PHP package michaeljennings/snapshot without Composer

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

Snapshot Latest Stable Version License

A PHP package that stores a whoops-like snapshot of your application and allows you to retrieve it later to help with debugging.

The package also comes with Slack integration so you can receive notifications whenever a snapshot is captured.

Planned Features

Installation

This package requires PHP 5.4+ and includes laravel support.

To install through composer you can either use composer require michaeljennings/snapshot or include the package in your composer.json.

Then run either composer install or composer update to download the package.

Laravel Integration

To use the package with Laravel 5 add the snapshot service provider to the list of service providers in config/app.php.

Then add the Snapshot facade to the aliases array.

Then use php artisan vendor:publish to publish the config and database migrations.

The package comes with database migrations if you want to use a database store. To run the migrations use php artisan migrate to set up the snapshot database tables.

To use the package you can either use the Snapshot facade or if you prefer using dependency injection snapshot is bound to the IOC container by its interface.

Laravel 4 Integration

To use the package with Laravel 4 add the snapshot service provider to the list of service providers in app/config/app.php.

Then add the Snapshot facade to the aliases array.

Then use php artisan config:publish --path=vendor/michaeljennings/snapshot/config michaeljennings/snapshot to publish the config.

The package comes with database migrations if you want to use a database store. To run the migrations use php artisan migrate --package="michaeljennings/snapshot" --path=vendor/michaeljennings/snapshot/database/migrations to set up the snapshot database tables.

To use the package you can either use the Snapshot facade or if you prefer using dependency injection snapshot is bound to the IOC container by its interface.

Usage

To get started we first need to instantiate the snapshot class.

If you are using the laravel integration this is done for you when you register the service provider.

Taking a Snapshot

To take a snapshot of your application use the capture method.

This will store all of the debug stack trace and any server, post, get, file, cookie, session and environment variables.

If you want to store any additional data, i.e. the current user, you can pass an array of data to the capture method.

If you are specifically capturing an exception you can use the captureException method. The benefit of this method is you can override the exception message and code by passing them in. You can still store any additional data by passing it as the 4th parameter.

Rendering a Snapshot

To render a snapshot use the render method, this takes one parameter which is the id of the snapshot.

Finding a Snapshot

Alternatively if you want to choose how to render the snapshot yourself you can get the snapshot by its id using the find method.

Slack Integration

Snapshot also comes with Slack support through the excellent mankz/slack package.

In your config file just enable slack integration, and then add in your incoming webhook endpoint, channel, and username and you shall start receiving slack messages whenever a snapshot is captured.

This is very useful for catching errors before they are reported.

Customising the Message

By default the message will be #{snapshot-id} A new snapshot has been captured.

If you want to customise this message then you can extend the Michaeljennings\Snapshot\Listeners\SendToSlack.php event listener and override the getMessage method.

Then you simply need to update the listener subscribed in the snapshot config to the Michaeljennings\Snapshot\Events\SnapshotCaptured event to your new listener.

Adding Event Listeners

It is possible that you want something to happen every time a snapshot is captured. An example of this is how we send a message to slack whenever a snapshot is captured.

To do this we add in event listeners. There are two ways we can go about this, either you can subscribe you listeners in the listeners array in the config, or you can call the addListener method on the slack class.

To add one into the config set the key as the event you are subscribing to, and the value as an array of listeners.

To subscribe a listener using the addListener method pass the event name you are subscribing to as the first parameter, and then either a class name or a closure to use as a listener.


All versions of snapshot with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
league/event Version ~2.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 michaeljennings/snapshot contains the following files

Loading the files please wait ....