8000 GitHub - ni88yy/snapshot: A PHP package that stores a snapshot of your application and allows you to retrieve it later to help with debugging.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

License

Notifications You must be signed in to change notification settings

ni88yy/snapshot

 
 

Repository files navigation

Snapshot Latest Stable Version Latest Unstable 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.

Planned Features

  • File Store
  • More views to choose from

Installation

This package requires PHP 5.4+ and includes laravel 5 support.

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

"michaeljennings/snapshot": "~0.1"

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 app/config/app.php.

'providers' => array(

  'Michaeljennings\Snapshot\SnapshotServiceProvider'
  
);

Then add the Snapshot facade to the aliases array.

'aliases' => array(

  'Snapshot' => 'Michaeljennings\Snapshot\Facades\Snapshot',

);

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.

Snapshot::capture();

public function __construct(Michaeljennings\Snapshot\Contracts\Snapshot $snapshot)
{
    $this->snapshot = $snapshot;
}

Usage

Taking a Snapshot

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

$snapshot = new Snapshot($store, $renderer, $config);

$snapshot->capture();

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.

$snapshot->capture(['user_id' => 1]);

Rendering a Snapshot

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

$snapshot->render(1);

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.

$snapshot->find(1);
< 52BF /div>

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%
0