File tree 7 files changed +28
-20
lines changed
7 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Laravel errors Catcher for [Hawk.so](https://hawk.so).
16
16
### Install command
17
17
18
18
``` bash
19
- $ composer require codex-team/hawk.laravel
19
+ $ composer require codex-team/hawk.laravel:dev-main
20
20
```
21
21
22
22
To enable capturing unhandled exceptions for reporting to ` Hawk ` , modify your ` bootstrap/app.php ` file as follows:
@@ -42,17 +42,26 @@ return Application::configure(basePath: dirname(__DIR__))
42
42
})->create();
43
43
```
44
44
45
+ ### Register the Service Provider
46
+
47
+ To complete the setup, add the ` Hawk ` service provider to your ` config/app.php ` or ` bootstrap/providers.php ` file in the providers array:
48
+
49
+ ``` php
50
+ 'providers' => [
51
+ // Other service providers...
52
+ HawkBundle\ErrorLoggerServiceProvider::class,
53
+ ],
54
+ ```
55
+
45
56
### Configuration
46
57
47
58
Set up Hawk using the following command:
48
59
49
60
``` bash
50
- $ php artisan hawkbundle:publish --token= < your integration token >
61
+ $ php artisan hawkbundle:publish
51
62
```
52
63
53
- This command generates the config file (` config/hawk.php ` ) and adds the ` HAWK_TOKEN ` property to it.
54
-
55
- Alternatively, you can configure ` Hawk ` manually by adding the following line to the ` .env ` file:
64
+ This will create the configuration file (` config/hawk.php ` ), and you can manually add the ` HAWK_TOKEN ` in your ` .env ` file:
56
65
57
66
``` env
58
67
HAWK_TOKEN=<your integration token>
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src \Console \Commands ;
5
+ namespace HawkBundle \Console \Commands ;
6
6
7
7
use Illuminate \Console \Command ;
8
8
use Illuminate \Support \Facades \File ;
@@ -14,7 +14,7 @@ class PublishHawkConfig extends Command
14
14
15
15
public function handle ()
16
16
{
17
- $ token = $ this ->option ('token ' );
17
+ $ token = $ this ->option ('token ' ) ?: '' ;
18
18
19
19
$ sourcePath = __DIR__ . '/../../../config/hawk.php ' ;
20
20
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src ;
5
+ namespace HawkBundle ;
6
6
7
+ use HawkBundle \Console \Commands \PublishHawkConfig ;
8
+ use HawkBundle \Handlers \ErrorHandler ;
9
+ use HawkBundle \Services \ErrorLoggerService ;
7
10
use Illuminate \Support \ServiceProvider ;
8
- use src \Console \Commands \PublishHawkConfig ;
9
- use src \Handlers \ErrorHandler ;
10
- use src \Services \ErrorLoggerService ;
11
11
12
12
class ErrorLoggerServiceProvider extends ServiceProvider
13
13
{
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src \Facades ;
5
+ namespace HawkBundle \Facades ;
6
6
7
+ use HawkBundle \Services \ErrorLoggerService ;
7
8
use Illuminate \Support \Facades \Facade ;
8
- use src \Services \ErrorLoggerService ;
9
9
10
10
class ErrorLogger extends Facade
11
11
{
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src \Handlers ;
5
+ namespace HawkBundle \Handlers ;
6
6
7
+ use HawkBundle \Services \ErrorLoggerService ;
7
8
use Illuminate \Foundation \Exceptions \Handler as ExceptionHandler ;
8
- use src \Services \ErrorLoggerService ;
9
9
10
10
class ErrorHandler extends ExceptionHandler
11
11
{
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src ;
5
+ namespace HawkBundle ;
6
6
7
- use HawkBundle \Throwable ;
7
+ use HawkBundle \Services \ ErrorLoggerService ;
8
8
use Illuminate \Foundation \Configuration \Exceptions ;
9
- use src \Services \ErrorLoggerService ;
10
9
11
10
class Integration
12
11
{
13
12
public static function handles (Exceptions $ exceptions ): void
14
13
{
15
- $ exceptions ->reportable (static function (Throwable $ exception ) {
14
+ $ exceptions ->reportable (static function (\ Throwable $ exception ) {
16
15
app (ErrorLoggerService::class)->logException ($ exception );
17
16
});
18
17
}
Original file line number Diff line number Diff line change 2
2
3
3
declare (strict_types=1 );
4
4
5
- namespace src \Services ;
5
+ namespace HawkBundle \Services ;
6
6
7
7
class ErrorLoggerService
8
8
{
You can’t perform that action at this time.
0 commit comments