Skip to content

Commit

Permalink
Added Lumen installation instructions to the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
itsgoingd committed Aug 7, 2015
1 parent ba2f689 commit a9b305b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,48 @@ Clockwork::info(new Object()); // logs string representation of the objects if t
Clockwork::endEvent('event_name');
```

### Lumen

**NOTE: Lumen support is experimental, available in `1.x-dev` version.**

Once Clockwork is installed, you need to register the Clockwork service provider, in your `bootstrap/app.php`:

```php
$app->register(Clockwork\Support\Lumen\ClockworkServiceProvider::class);
```

You also need to add the Clockwork middleware, in the same file:

```php
$app->middleware([
...
Clockwork\Support\Lumen\ClockworkMiddleware::class
]);
```

By default, Clockwork will only be available in debug mode (`APP_DEBUG` set to true), you can change this and other settings via environment variables.
Simply specify the setting as environment variable prefixed with `CLOCKWORK_`, eg. CLOCKWORK_ENABLE, [full list of available settings](https://raw.githubusercontent.com/itsgoingd/clockwork/v1/Clockwork/Support/Laravel/config/clockwork.php).

Clockwork also comes with a facade, which provides an easy way to add records to the Clockwork log and events to the timeline. The facade will be automatically registered when you enable facades for your Lumen app, in `bootstrap/app.php`:

```php
$app->withFacades();
```

Now you can use the following commands:

```php
Clockwork::startEvent('event_name', 'Event description.'); // event called 'Event description.' appears in Clockwork timeline tab

Clockwork::info('Message text.'); // 'Message text.' appears in Clockwork log tab
Log::info('Message text.'); // 'Message text.' appears in Clockwork log tab as well as application log file

Clockwork::info(array('hello' => 'world')); // logs json representation of the array
Clockwork::info(new Object()); // logs string representation of the objects if the object implements __toString magic method, logs json representation of output of toArray method if the object implements it, if neither is the case, logs json representation of the object cast to array

Clockwork::endEvent('event_name');
```

### Slim 2

Once Clockwork is installed, you need to add Slim middleware to your app:
Expand Down

0 comments on commit a9b305b

Please sign in to comment.