Clockwork

php dev tools integrated to your browser

Clockwork screenshot Clockwork screenshot Clockwork screenshot

User data

While you can log anything using the rich logging capabilities or add custom timeline events, sometimes your app has a specific data you'd like to be easily accessible for each request.

User-data api is here for cases like this. With user data you can add custom data, shown as a new tab in the Clockwork app, formatted as a table or as counters (similar to performance tab).

Let's say we are building an eshop app. Instead of logging the cart contents and looking for them in the log tab, we can make a new "Cart" tab which will show some stats and the cart contents:

$cart = clock()->userData('cart')   ->title('Cart');   $cart->counters([   'Products' => 3,   'Value' => '949.80€' ]);   $cart->table('Products', [   [ 'Product' => 'iPad Pro 10.5" 256G Silver', 'Price' => '849 €' ],   [ 'Product' => 'Smart Cover iPad Pro 10.5 White', 'Price' => '61.90 €' ],   [ 'Product' => 'Apple Lightning to USB 3 Camera Adapter', 'Price' => '38.90 €' ] ]);

We are using static data for demonstration, in a real implementation the data would come from a database or session based on your cart implementation.