upgrade to laravel 7 and set branch to v2

This commit is contained in:
2020-12-25 11:22:15 +00:00
parent 516105c492
commit 0ddd298350
4638 changed files with 132501 additions and 190226 deletions

View File

@@ -8,8 +8,6 @@ Bringing the [Symfony Var-Dump Server](https://symfony.com/doc/current/component
This package will give you a dump server, that collects all your `dump` call outputs, so that it does not interfere with HTTP / API responses.
> If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.
## Installation
You can install the package via composer:
@@ -18,37 +16,9 @@ You can install the package via composer:
composer require --dev beyondcode/laravel-dump-server
```
The package will register itself automatically.
## Documentation
Optionally you can publish the package configuration using:
```bash
php artisan vendor:publish --provider=BeyondCode\\DumpServer\\DumpServerServiceProvider
```
This will publish a file called `debug-server.php` in your `config` folder.
In the config file, you can specify the dump server host that you want to listen on, in case you want to change the default value.
## Usage
Start the dump server by calling the artisan command:
```bash
php artisan dump-server
```
You can set the output format to HTML using the `--format` option:
```bash
php artisan dump-server --format=html > dump.html
```
And then you can, as you are used to, put `dump` calls in your methods. But instead of dumping the output in your current HTTP request, they will be dumped in the artisan command.
This is very useful, when you want to dump data from API requests, without having to deal with HTTP errors.
You can see it in action here:
![Dump Server Demo](https://beyondco.de/github/dumpserver/dumpserver.gif)
You can find the documentation on the [Beyond Code website](https://beyondco.de/docs/laravel-dump-server/installation).
### Changelog

View File

@@ -16,15 +16,15 @@
}
],
"require": {
"php": "^7.1",
"illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0",
"illuminate/http": "5.6.*|5.7.*|5.8.*|^6.0",
"illuminate/support": "5.6.*|5.7.*|5.8.*|^6.0",
"symfony/var-dumper": "^4.1.1"
"php": ">=7.2.5",
"illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0",
"illuminate/http": "5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0",
"illuminate/support": "5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.0",
"symfony/var-dumper": "^5.0"
},
"require-dev": {
"larapack/dd": "^1.0",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^7.0|^9.3"
},
"autoload": {
"psr-4": {

View File

@@ -4,5 +4,5 @@ return [
/*
* The host to use when listening for debug server connections.
*/
'host' => 'tcp://127.0.0.1:9912',
'host' => env('DUMP_SERVER_HOST', 'tcp://127.0.0.1:9912'),
];

View File

@@ -0,0 +1,4 @@
---
packageName: Laravel Dump Server
githubUrl: https://github.com/beyondcode/laravel-dump-server
---

View File

@@ -0,0 +1,30 @@
---
title: Installation
order: 1
---
# Laravel Dump Server
Bringing the Symfony Var-Dump Server to Laravel.
This package will give you a dump server, that collects all your dump call outputs, so that it does not interfere with HTTP / API responses.
![Dump Server Demo](/img/example.gif)
# Installation
You can install the package via composer:
```bash
composer require --dev beyondcode/laravel-dump-server
```
The package will register itself automatically.
Optionally you can publish the package configuration using:
```bash
php artisan vendor:publish --provider="BeyondCode\DumpServer\DumpServerServiceProvider"
```
This will publish a file called `debug-server.php` in your `config` folder.
In the config file, you can specify the dump server host that you want to listen on, in case you want to change the default value.

View File

@@ -0,0 +1,22 @@
---
title: Usage
order: 2
---
# Usage
Start the dump server by calling the artisan command:
```bash
php artisan dump-server
```
You can set the output format to HTML using the `--format` option:
```bash
php artisan dump-server --format=html > dump.html
```
Now you can put regular `dump` statements in your code. Instead of dumping the output directly in the HTTP response, the dumped data will be shown inside of your terminal / the running artisan command.
This is very useful, when you want to dump data from API requests, without having to deal with HTTP errors.

View File

@@ -50,7 +50,7 @@ class DumpServerServiceProvider extends ServiceProvider
]);
VarDumper::setHandler(function ($var) use ($connection) {
(new Dumper($connection))->dump($var);
$this->app->makeWith(Dumper::class, ['connection' => $connection])->dump($var);
});
}
}

View File

@@ -36,7 +36,7 @@ class Dumper
public function dump($value)
{
if (class_exists(CliDumper::class)) {
$data = (new VarCloner)->cloneVar($value);
$data = $this->createVarCloner()->cloneVar($value);
if ($this->connection === null || $this->connection->write($data) === false) {
$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper;
@@ -46,4 +46,12 @@ class Dumper
var_dump($value);
}
}
/**
* @return VarCloner
*/
protected function createVarCloner(): VarCloner
{
return new VarCloner();
}
}