Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
199 lars 1
<p align="center">
2
	<img width="300px" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/title.png">
3
	<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/screenshot.png">
4
</p>
5
 
6
> Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs, rendered views and more - for HTTP requests, commands, queue jobs and tests.
7
 
8
> *This repository contains the server-side component of Clockwork.*
9
 
10
> Check out on the [Clockwork website](https://underground.works/clockwork) for details.
11
 
12
<p align="center">
13
	<a href="https://underground.works/clockwork">
14
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-1.png">
15
	</a>
16
	<a href="https://underground.works/clockwork">
17
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-2.png">
18
	</a>
19
	<a href="https://underground.works/clockwork">
20
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-3.png">
21
	</a>
22
	<a href="https://underground.works/clockwork">
23
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-4.png">
24
	</a>
25
	<a href="https://underground.works/clockwork">
26
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-5.png">
27
	</a>
28
	<a href="https://underground.works/clockwork">
29
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-6.png">
30
	</a>
31
	<a href="https://underground.works/clockwork">
32
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-7.png">
33
	</a>
34
	<a href="https://underground.works/clockwork">
35
		<img width="100%" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/features-8.png">
36
	</a>
37
</p>
38
 
39
### Installation
40
 
41
Install the Clockwork library via [Composer](https://getcomposer.org/).
42
 
43
```
44
$ composer require itsgoingd/clockwork
45
```
46
 
47
Congratulations, you are done! To enable more features like commands or queue jobs profiling, publish the configuration file via the `vendor:publish` Artisan command.
48
 
49
**Note:** If you are using the Laravel route cache, you will need to refresh it using the route:cache Artisan command.
50
 
51
Read [full installation instructions](https://underground.works/clockwork/#docs-installation) on the Clockwork website.
52
 
53
### Features
54
 
55
#### Collecting data
56
 
57
The Clockwork server-side component collects and stores data about your application.
58
 
59
Clockwork is only active when your app is in debug mode by default. You can choose to explicitly enable or disable Clockwork, or even set Clockwork to always collect data without exposing them for further analysis.
60
 
61
We collect a whole bunch of useful data by default, but you can enable more features or disable features you don't need in the config file.
62
 
63
Some features might allow for advanced options, eg. for database queries you can set a slow query threshold or enable detecting of duplicate (N+1) queries. Check out the config file to see all what Clockwork can do.
64
 
65
There are several options that allow you to choose for which requests Clockwork is active.
66
 
67
On-demand mode will collect data only when Clockwork app is open. You can even specify a secret to be set in the app settings to collect request. Errors only will record only requests ending with 4xx and 5xx responses. Slow only will collect only requests with responses above the set slow threshold. You can also filter the collected and recorded requests by a custom closure. CORS pre-flight requests will not be collected by default.
68
 
69
New in Clockwork 4.1, artisan commands, queue jobs and tests can now also be collected, you need to enable this in the config file.
70
 
71
Clockwork also collects stack traces for data like log messages or database queries. Last 10 frames of the trace are collected by default. You can change the frames limit or disable this feature in the configuration file.
72
 
73
#### Viewing data
74
 
75
##### Web interface
76
 
77
Open `your.app/clockwork` to view and interact with the collected data.
78
 
79
The app will show all executed requests, which is useful when the request is not made by browser, but for example a mobile application you are developing an API for.
80
 
81
##### Browser extension
82
 
83
A browser dev tools extension is also available for Chrome and Firefox:
84
 
85
- [Chrome Web Store](https://chrome.google.com/webstore/detail/clockwork/dmggabnehkmmfmdffgajcflpdjlnoemp)
86
- [Firefox Addons](https://addons.mozilla.org/en-US/firefox/addon/clockwork-dev-tools/)
87
 
88
##### Toolbar
89
 
90
Clockwork now gives you an option to show basic request information in the form of a toolbar in your app.
91
 
92
The toolbar is fully rendered client-side and requires installing a tiny javascript library.
93
 
94
[Learn more](https://underground.works/clockwork/#docs-viewing-data) on the Clockwork website.
95
 
96
#### Logging
97
 
98
You can log any variable via the clock() helper, from a simple string to an array or object, even multiple values:
99
 
100
```php
101
clock(User::first(), auth()->user(), $username)
102
```
103
 
104
The `clock()` helper function returns it's first argument, so you can easily add inline debugging statements to your code:
105
 
106
```php
107
User::create(clock($request->all()))
108
```
109
 
110
If you want to specify a log level, you can use the long-form call:
111
 
112
```php
113
clock()->info("User {$username} logged in!")
114
```
115
 
116
#### Timeline
117
 
118
Timeline gives you a visual representation of your application runtime.
119
 
120
To add an event to the timeline - start it with a description, execute the tracked code and finish the event. A fluent api is available to further configure the event.
121
 
122
```php
123
// using timeline api with begin/end and fluent configuration
124
clock()->event('Importing tweets')->color('purple')->begin();
125
    ...
126
clock()->event('Importing tweets')->end();
127
```
128
 
129
Alternatively you can execute the tracked code block as a closure. You can also choose to use an array based configuration instead of the fluent api.
130
 
131
```php
132
// using timeline api with run and array-based configuration
133
clock()->event('Updating cache', [ 'color' => 'green' ])->run(function () {
134
    ...
135
});
136
```
137
 
138
Read more about available features on the [Clockwork website](https://underground.works/clockwork).
139
 
140
<p align="center">
141
	<a href="https://underground.works">
142
		<img width="150px" src="https://github.com/itsgoingd/clockwork/raw/master/.github/assets/footer.png">
143
	</a>
144
</p>