Skip to content

Commit

Permalink
Fills all docs sections
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Nov 15, 2023
1 parent ce0f756 commit 370af7b
Show file tree
Hide file tree
Showing 15 changed files with 640 additions and 185 deletions.
33 changes: 21 additions & 12 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,47 @@ export default defineConfig({
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{text: 'Home', link: '/'},
{text: 'Docs', link: '/intro'}
{text: 'Docs', link: '/'},
],

sidebar: [
{
text: 'Introduction',
text: 'What is Buggregator?',
link: '/',
},
{
text: 'Getting Started',
link: '/getting-started',
},
{
text: 'Contributing',
items: [
{
text: 'What is Buggregator?',
link: '/intro',
text: 'Architecture',
link: '/contributing/architecture',
},
{
text: 'Getting Started',
link: '/getting-started',
text: 'Server',
link: '/contributing/server',
},
{
text: 'Contributing',
link: '/contributing',
text: 'Frontend',
link: '/contributing/frontend',
},
]
},

{
text: 'Configuration',
items: [
{text: 'Sentry', link: '/config/sentry'},
{text: 'VarDumper', link: '/config/var-dumper'},
{text: 'XHProf', link: '/config/xhprof'},
{text: 'Monolog', link: '/config/monolog'},
{text: 'VarDumper', link: '/config/var-dumper'},
{text: 'Ray', link: '/config/ray'},
{text: 'Sentry', link: '/config/sentry'},
{text: 'SMTP server', link: '/config/smtp'},
{text: 'Monolog', link: '/config/monolog'},
{text: 'Inspector', link: '/config/inspector'},
{text: 'Http Dumps', link: '/config/http-dumps'},
]
}
],
Expand Down
16 changes: 16 additions & 0 deletions docs/config/http-dumps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration — HTTP dumps

It's an indispensable tool that simplifies the process of capturing, analyzing, and debugging HTTP requests in their
applications. With the HTTP Requests Dump Server, developers can effortlessly capture all the relevant request data and
gain valuable insights. They can dive deep into the captured requests, examine their contents, and pinpoint any issues
or anomalies that might be affecting their application's performance.

Simply start the server and send your requests to the `http:https://[email protected]:8000` URL, it will not only
capture the URI segments but also gather additional details such as the request `headers`, `cookies`, `POST data`,
`query strings`, and any `uploaded files`.

For instance, let's say you have a POST request: `http:https://[email protected]:8000/user/3/update`. In this case,
server will intercept the request and capture all the relevant information. It will then display the
dumped data, allowing you to examine the request details, including the URI segments (`user/3/update` in this example).

![HTTP Requests dump server](https://github.com/spiral/docs/assets/773481/209f9c8c-00d2-4086-9f54-ce2cf8121394)
40 changes: 40 additions & 0 deletions docs/config/inspector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Configuration — Inspector

Buggregator is also compatible with Inspector reports, providing you with a lightweight alternative for local
development. With it, you can easily configure your Inspector client URL to send data directly to the server, making it
easier to identify and fix issues during the development phase.

![inspector](https://user-images.githubusercontent.com/773481/208734651-e8dca2bf-6674-4aed-b6fc-601bc877f7ce.png)

## Laravel

Laravel is supported via a native package. You can read about integrations
on [official site](https://docs.inspector.dev/laravel)

```php
INSPECTOR_URL=http:https://[email protected]:8000
INSPECTOR_API_KEY=test
INSPECTOR_INGESTION_KEY=1test
INSPECTOR_ENABLE=true
```

## Other platforms

For PHP you can use `inspector-apm/inspector-php` package.

```php
use Inspector\Inspector;
use Inspector\Configuration;

$configuration = new Configuration('YOUR_INGESTION_KEY');
$configuration->setUrl('http:https://[email protected]:8000');
$inspector = new Inspector($configuration);

// ...
```

To report to Buggregator you’ll need to use a language-specific SDK. The Inspector team builds and maintains these for
most popular languages.

> **Note:**
> You can find out documentation on [official site](https://docs.inspector.dev/)
102 changes: 102 additions & 0 deletions docs/config/monolog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Configuration — Monolog

Buggregator comes with a powerful Monolog server that can receive logs from the popular `monolog/monolog` package via
the `\Monolog\Handler\SocketHandler` handler. With this feature, you can easily track and analyze the logs generated by
your PHP application, making it easier to identify issues and improve its overall performance.

By using Buggregator's Monolog server, you can gain valuable insights into your application's behavior and improve its
overall efficiency. So, whether you're a seasoned developer or just starting, the Monolog server in Buggregator is a
must-have tool for anyone serious about PHP development.

![monolog](https://user-images.githubusercontent.com/773481/208729325-b135870e-3a98-4841-90cb-6e507108a235.png)

## Spiral Framework

You can register socket handler for monolog via bootloader.

**Bootloader example**

```php
<?php

declare(strict_types=1);

namespace App\Bootloader;

use Monolog\Formatter\JsonFormatter;
use Monolog\Handler\SocketHandler;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Monolog\Bootloader\MonologBootloader;

class LoggingBootloader extends Bootloader
{
public function init(MonologBootloader $monolog, EnvironmentInterface $env): void
{
$handler = new SocketHandler($env->get('MONOLOG_SOCKET_HOST'), chunkSize: 10);
$handler->setFormatter(new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES));
$monolog->addHandler('socket', $handler);
}
}
```

**Env variables**

```dotenv
MONOLOG_DEFAULT_CHANNEL=socket
MONOLOG_SOCKET_HOST=127.0.0.1:9913
```

## Laravel

```php
// config/logging.php
return [
// ...
'channels' => [
// ...
'socket' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => \Monolog\Handler\SocketHandler::class,
'formatter' => \Monolog\Formatter\JsonFormatter::class,
'handler_with' => [
'connectionString' => env('LOG_SOCKET_URL', '127.0.0.1:9913'),
],
],
],
];
```

### Configuration

```dotenv
LOG_CHANNEL=socket
LOG_SOCKET_URL=127.0.0.1:9913
```

## Other PHP frameworks

Install monolog

```bash
composer require monolog/monolog
```

```php
<?php

use Monolog\Logger;
use Monolog\Handler\SocketHandler;
use Monolog\Formatter\JsonFormatter;

// create a log channel
$log = new Logger('buggregator');
$handler = new SocketHandler('127.0.0.1:9913');
$handler->setFormatter(new JsonFormatter());
$log->pushHandler($handler);

// Send records to the Buggregator
$log->warning('Foo');
$log->error('Bar');
```
73 changes: 73 additions & 0 deletions docs/config/ray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Configuration — Spatie Ray

Buggregator is compatible with `spatie/ray` package. The Ray debug tool supports PHP, Ruby, JavaScript, TypeScript,
NodeJS, Go and Bash applications. After installing one of the libraries, you can use the ray function to quickly dump
stuff. Any variable(s) that you pass will be sent to the Buggregator.

![Ray debug tool](https://github.com/buggregator/spiral-app/assets/773481/c2a84d40-fc99-4bde-b87f-ea81cc1daa17)

**Supported features**: Simple data, Labels, Caller, Trace, Counter, Class name of an object, Measure, Json, Xml,
Carbon, File, Table, Image, Html, Text, Notifications, Phpinfo, Exception, Show queries, Count queries, Show events,
Show jobs, Show cache, Model, Show views, Markdown, Collections, Env, Response, Request, Application log, Show Http
client requests

## Laravel

Please make sure `ray.php` config published to the project root.

You can run an artisan command to publish it in to the project root.

```bash
php artisan ray:publish-config
```

**Env variables**

```
[email protected] # Ray server host (Current HTTP buggregator port)
RAY_PORT=8000 # Ray server port
```

## Framework agnostic PHP

In framework agnostic projects you can use this template as the ray config file.

```php
<?php
// Save this in a file called "ray.php"

return [
/*
* This settings controls whether data should be sent to Ray.
*/
'enable' => true,

/*
* The host used to communicate with the Ray app.
*/
'host' => '[email protected]',

/*
* The port number used to communicate with the Ray app.
*/
'port' => 8000,

/*
* Absolute base path for your sites or projects in Homestead, Vagrant, Docker, or another remote development server.
*/
'remote_path' => null,

/*
* Absolute base path for your sites or projects on your local computer where your IDE or code editor is running on.
*/
'local_path' => null,

/*
* When this setting is enabled, the package will not try to format values sent to Ray.
*/
'always_send_raw_values' => false,
];
```

You can find out more information about installation and configuration
on [official site](https://spatie.be/docs/ray/v1/introduction)
58 changes: 58 additions & 0 deletions docs/config/sentry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Configuration — Sentry exceptions

Buggregator offers seamless integration with Sentry reports, making it a reliable tool for local development. With
it, you can easily configure your Sentry DSN to send data directly to the server, providing you with a lightweight
alternative for debugging your application.

![sentry](https://user-images.githubusercontent.com/773481/208728578-1b33174b-8d1f-411a-a6fe-180a89abf06f.png)

By using Buggregator to receive Sentry reports, you can identify and fix issues with your application before deploying
it to production. This ensures that your application is robust and efficient, providing a smooth experience for your
users. So, if you're looking for an easy and efficient way to receive Sentry reports during local development,
Buggregator is the perfect tool for you.

## What is Sentry?

[Sentry](https://sentry.io/) is an error tracking tool that helps developers monitor and fix crashes in real-time. It's
a powerful tool for understanding what's happening with your applications in production.

## Laravel

### Installation

Laravel is supported via a native package. You can read about integrations
on [official site](https://docs.sentry.io/platforms/php/guides/laravel/)

### Configuration

All you need to do is set the `SENTRY_LARAVEL_DSN` environment variable in your `.env` file:

```dotenv
SENTRY_LARAVEL_DSN=http:https://[email protected]:8000/1
```

## Spiral Framework

### Installation

Spiral Framework is supported via a native package. You can read about integrations
on [official site](https://spiral.dev/docs/extension-sentry/3.3/en)

### Configuration

All you need to do is set the `SENTRY_LARAVEL_DSN` environment variable in your `.env` file:

```dotenv
SENTRY_DSN=http:https://[email protected]:8000/1
```

## Other platforms

To report to Buggregator you’ll need to use a language-specific SDK. The Sentry team builds and maintains these for most
popular languages. You can find out documentation on [official site](https://docs.sentry.io/platforms/)

After you have installed the SDK, you can configure Sentry DSN to report to Buggregator:

```dotenv
SENTRY_DSN=http:https://[email protected]:8000/1
```
25 changes: 25 additions & 0 deletions docs/config/smtp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Configuration — Fake SMTP server

Buggregator is more than just a PHP debugging tool. It also includes a powerful email testing feature that allows you to
install and configure a local email server with ease.

For example, you can configure a local WordPress site to use Buggregator's SMTP server for email deliveries. This makes
it effortless to test email functionality during the development phase, ensuring that everything works as expected
before deployment. So, if you're looking for a reliable and easy-to-use email testing tool, Buggregator's fake SMTP
server is the way to go.

![smtp](https://user-images.githubusercontent.com/773481/208727862-229fda5f-3504-4377-921e-03f0ff602cb9.png)

## Spiral Framework

```dotenv
MAILER_DSN=smtp:https://127.0.0.1:1025
```

## Laravel

```dotenv
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
```
Loading

0 comments on commit 370af7b

Please sign in to comment.