updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -0,0 +1,7 @@
# Changelog
All notable changes to `laravel-dump-server` will be documented in this file
## 1.0.0 - 2018-07-09
- initial release

View File

@@ -0,0 +1,55 @@
# Contributing
Contributions are **welcome** and will be fully **credited**.
Please read and understand the contribution guide before creating an issue or pull request.
## Etiquette
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
## Viability
When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.
## Procedure
Before filing an issue:
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.
Before submitting a pull request:
- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
## Requirements
If the project maintainer has any additional requirements, you will find them listed here.
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
**Happy coding**!

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Beyond Code GmbH <hello@beyondco.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,73 @@
# Laravel Dump Server
[![Latest Version on Packagist](https://img.shields.io/packagist/v/beyondcode/laravel-dump-server.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-dump-server)
[![Quality Score](https://img.shields.io/scrutinizer/g/beyondcode/laravel-dump-server.svg?style=flat-square)](https://scrutinizer-ci.com/g/beyondcode/laravel-dump-server)
[![Total Downloads](https://img.shields.io/packagist/dt/beyondcode/laravel-dump-server.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-dump-server)
Bringing the [Symfony Var-Dump Server](https://symfony.com/doc/current/components/var_dumper.html#the-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.
> 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:
```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.
## 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)
### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email marcel@beyondco.de instead of using the issue tracker.
## Credits
- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

View File

@@ -0,0 +1,56 @@
{
"name": "beyondcode/laravel-dump-server",
"description": "Symfony Var-Dump Server for Laravel",
"keywords": [
"beyondcode",
"laravel-dump-server"
],
"homepage": "https://github.com/beyondcode/laravel-dump-server",
"license": "MIT",
"authors": [
{
"name": "Marcel Pociot",
"email": "marcel@beyondco.de",
"homepage": "https://beyondco.de",
"role": "Developer"
}
],
"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"
},
"require-dev": {
"larapack/dd": "^1.0",
"phpunit/phpunit": "^7.0"
},
"autoload": {
"psr-4": {
"BeyondCode\\DumpServer\\": "src"
},
"files": [
"helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"BeyondCode\\DumpServer\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"BeyondCode\\DumpServer\\DumpServerServiceProvider"
]
}
}
}

View File

@@ -0,0 +1,8 @@
<?php
return [
/*
* The host to use when listening for debug server connections.
*/
'host' => 'tcp://127.0.0.1:9912',
];

View File

@@ -0,0 +1,16 @@
<?php
if (! function_exists('config_path')) {
/**
* Get the configuration path.
*
* This is a polyfill for the missing shorthand function in lumen.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->basePath('config').($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace BeyondCode\DumpServer;
use Illuminate\Console\Command;
use InvalidArgumentException;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Server\DumpServer;
use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor;
use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor;
class DumpServerCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dump-server {--format=cli : The output format (cli,html).}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Start the dump server to collect dump information.';
/**
* The Dump server.
*
* @var \Symfony\Component\VarDumper\Server\DumpServer
*/
protected $server;
/**
* DumpServerCommand constructor.
*
* @param \Symfony\Component\VarDumper\Server\DumpServer $server
* @return void
*/
public function __construct(DumpServer $server)
{
$this->server = $server;
parent::__construct();
}
/**
* Handle the command.
*
* @return void
*/
public function handle()
{
switch ($format = $this->option('format')) {
case 'cli':
$descriptor = new CliDescriptor(new CliDumper);
break;
case 'html':
$descriptor = new HtmlDescriptor(new HtmlDumper);
break;
default:
throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $format));
}
$io = new SymfonyStyle($this->input, $this->output);
$errorIo = $io->getErrorStyle();
$errorIo->title('Laravel Var Dump Server');
$this->server->start();
$errorIo->success(sprintf('Server listening on %s', $this->server->getHost()));
$errorIo->comment('Quit the server with CONTROL-C.');
$this->server->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) {
$descriptor->describe($io, $data, $context, $clientId);
});
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace BeyondCode\DumpServer;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\VarDumper\VarDumper;
use Symfony\Component\VarDumper\Server\Connection;
use Symfony\Component\VarDumper\Server\DumpServer;
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
class DumpServerServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('debug-server.php'),
], 'config');
}
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'debug-server');
$this->app->bind('command.dumpserver', DumpServerCommand::class);
$this->commands([
'command.dumpserver',
]);
$host = $this->app['config']->get('debug-server.host');
$this->app->when(DumpServer::class)->needs('$host')->give($host);
$connection = new Connection($host, [
'request' => new RequestContextProvider($this->app['request']),
'source' => new SourceContextProvider('utf-8', base_path()),
]);
VarDumper::setHandler(function ($var) use ($connection) {
(new Dumper($connection))->dump($var);
});
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace BeyondCode\DumpServer;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\Server\Connection;
class Dumper
{
/**
* The connection.
*
* @var \Symfony\Component\VarDumper\Server\Connection|null
*/
private $connection;
/**
* Dumper constructor.
*
* @param \Symfony\Component\VarDumper\Server\Connection|null $connection
* @return void
*/
public function __construct(Connection $connection = null)
{
$this->connection = $connection;
}
/**
* Dump a value with elegance.
*
* @param mixed $value
* @return void
*/
public function dump($value)
{
if (class_exists(CliDumper::class)) {
$data = (new VarCloner)->cloneVar($value);
if ($this->connection === null || $this->connection->write($data) === false) {
$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper;
$dumper->dump($data);
}
} else {
var_dump($value);
}
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace BeyondCode\DumpServer;
use Illuminate\Http\Request;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
class RequestContextProvider implements ContextProviderInterface
{
/**
* The current request.
*
* @var \Illuminate\Http\Request|null
*/
private $currentRequest;
/**
* The variable cloner.
*
* @var \Symfony\Component\VarDumper\Cloner\VarCloner
*/
private $cloner;
/**
* RequestContextProvider constructor.
*
* @param \Illuminate\Http\Request|null $currentRequest
* @return void
*/
public function __construct(Request $currentRequest = null)
{
$this->currentRequest = $currentRequest;
$this->cloner = new VarCloner;
$this->cloner->setMaxItems(0);
}
/**
* Get the context.
*
* @return array|null
*/
public function getContext(): ?array
{
if ($this->currentRequest === null) {
return null;
}
$controller = null;
if ($route = $this->currentRequest->route()) {
$controller = $route->controller;
if (! $controller && ! is_string($route->action['uses'])) {
$controller = $route->action['uses'];
}
}
return [
'uri' => $this->currentRequest->getUri(),
'method' => $this->currentRequest->getMethod(),
'controller' => $controller ? $this->cloner->cloneVar(class_basename($controller)) : $this->cloner->cloneVar(null),
'identifier' => spl_object_hash($this->currentRequest),
];
}
}