Skip to content

Commit 5b99e39

Browse files
authored
Merge pull request #2 from codex-team/dev-testing
Update instructions and fix namespaces
2 parents b9f20a9 + df2c1cd commit 5b99e39

File tree

7 files changed

+28
-20
lines changed

7 files changed

+28
-20
lines changed

README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Laravel errors Catcher for [Hawk.so](https://hawk.so).
1616
### Install command
1717

1818
```bash
19-
$ composer require codex-team/hawk.laravel
19+
$ composer require codex-team/hawk.laravel:dev-main
2020
```
2121

2222
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__))
4242
})->create();
4343
```
4444

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+
4556
### Configuration
4657

4758
Set up Hawk using the following command:
4859

4960
```bash
50-
$ php artisan hawkbundle:publish --token=<your integration token>
61+
$ php artisan hawkbundle:publish
5162
```
5263

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:
5665

5766
```env
5867
HAWK_TOKEN=<your integration token>

src/Console/Commands/PublishHawkConfig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace src\Console\Commands;
5+
namespace HawkBundle\Console\Commands;
66

77
use Illuminate\Console\Command;
88
use Illuminate\Support\Facades\File;
@@ -14,7 +14,7 @@ class PublishHawkConfig extends Command
1414

1515
public function handle()
1616
{
17-
$token = $this->option('token');
17+
$token = $this->option('token') ?: '';
1818

1919
$sourcePath = __DIR__ . '/../../../config/hawk.php';
2020

src/ErrorLoggerServiceProvider.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types=1);
44

5-
namespace src;
5+
namespace HawkBundle;
66

7+
use HawkBundle\Console\Commands\PublishHawkConfig;
8+
use HawkBundle\Handlers\ErrorHandler;
9+
use HawkBundle\Services\ErrorLoggerService;
710
use Illuminate\Support\ServiceProvider;
8-
use src\Console\Commands\PublishHawkConfig;
9-
use src\Handlers\ErrorHandler;
10-
use src\Services\ErrorLoggerService;
1111

1212
class ErrorLoggerServiceProvider extends ServiceProvider
1313
{

src/Facades/ErrorLogger.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace src\Facades;
5+
namespace HawkBundle\Facades;
66

7+
use HawkBundle\Services\ErrorLoggerService;
78
use Illuminate\Support\Facades\Facade;
8-
use src\Services\ErrorLoggerService;
99

1010
class ErrorLogger extends Facade
1111
{

src/Handlers/ErrorHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace src\Handlers;
5+
namespace HawkBundle\Handlers;
66

7+
use HawkBundle\Services\ErrorLoggerService;
78
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8-
use src\Services\ErrorLoggerService;
99

1010
class ErrorHandler extends ExceptionHandler
1111
{

src/Integration.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
declare(strict_types=1);
44

5-
namespace src;
5+
namespace HawkBundle;
66

7-
use HawkBundle\Throwable;
7+
use HawkBundle\Services\ErrorLoggerService;
88
use Illuminate\Foundation\Configuration\Exceptions;
9-
use src\Services\ErrorLoggerService;
109

1110
class Integration
1211
{
1312
public static function handles(Exceptions $exceptions): void
1413
{
15-
$exceptions->reportable(static function (Throwable $exception) {
14+
$exceptions->reportable(static function (\Throwable $exception) {
1615
app(ErrorLoggerService::class)->logException($exception);
1716
});
1817
}

src/Services/ErrorLoggerService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace src\Services;
5+
namespace HawkBundle\Services;
66

77
class ErrorLoggerService
88
{

0 commit comments

Comments
 (0)