Skip to content

Commit

Permalink
初始化第一个版本
Browse files Browse the repository at this point in the history
  • Loading branch information
yangweijie committed Sep 30, 2022
1 parent c927369 commit ce7e264
Show file tree
Hide file tree
Showing 31 changed files with 1,592 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[*.{vue,js,scss}]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto

/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.php export-ignore
phpunit.xml.dist export-ignore
phpunit.xml export-ignore
.php_cs export-ignore
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
*.DS_Store
/vendor
/coverage
sftp-config.json
composer.lock
.subsplit
.php_cs.cache
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<h1 align="center"> think-laradumps </h1>

<p align="center"> debug tool Using Laradumps App in ThinkPHP6</p>

<p align="center">
<img src="./art/logo.png" height="128" alt="" />
</p>
<h1 align="center">LaraDumps</h1>
<div align="center">
<br />
<p align="center">
<a href="https://github.com/laradumps/app/releases/download/v1.2.3/LaraDumps-Setup-1.2.3.exe">
<img src="./art/os/windows.png" height="60" alt="LaraDumps Windows App" />
</a>
<a href="https://github.com/laradumps/app/releases/download/v1.2.3/LaraDumps-1.2.3.dmg">
<img src="./art/os/macos.png" height="60" alt="LaraDumps MacOS App" />
</a>
<a href="https://github.com/laradumps/app/releases/download/v1.2.3/LaraDumps-1.2.3.AppImage">
<img src="./art/os/linux.png" height="60" alt="LaraDumps Linux App" />
</a>
</p>
<h3>Click on your OS logo to download the Desktop App.</h3>
<sub>Available for Windows, Linux and macOS.</sub>
<br />
<br />
<p>
<a href="https://laradumps.dev"> 📚 Documentation </a>
</p>
</div>
<br/>


## 安装

```shell
$ composer require yangweijie/think-laradumps --dev -vvv
```

## 用法

### 👋 Hello Dev,

<br/>

### Get Started

#### Requirements

PHP 7.2+ and ThinkPHP6.0+

#### Usage

3. 配置 LaraDumps :

编辑 安装扩展后自动创建的 laradumps 配置文件

4. 调试你的代码通过使用 `ds()` 和 ThinkPHP 应用里的 trace 一样使用。

> dsd == halt
5. 运行应用,然后看到调试的信息在 LaraDumps App 窗口里。

Here's an example:

```php
Route::get('/', function () {
ds('Home page accessed!');
return view('home');
});
```

```php
ds('')->phpinfo();
```

```php
ds()->table([['id'=1,'name'=>'a']], 'table');
```

```php
ds()->time('event');
ds()->stopTime('event');

```
```php
ds('调试信息1')->s('tab1'); // 可以输出不同调试到不同tab
```

至于显示日志功能,和监听sql,再考虑要不要实现,因为目前这个函数输出的是和ThinkPHP log 独立开来的。
要高度扩展,可以实现基于本库再实现一个log 的驱动,倒时候配置database 的 trace 就行了。

## License

MIT
Binary file added art/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/os/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/os/macos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/os/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "yangweijie\/think-laradumps",
"description": "debug tool Using Laradumps App in ThinkPHP",
"license": "MIT",
"authors": [
{
"name": "yangweijie",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.2.0",
"topthink/framework": "6.0.*",
"ramsey/uuid": "^4.2"
},
"autoload": {
"psr-4": {
"think\\Laradumps\\": "src"
},
"files": [
"src/functions.php"
]
},
"extra": {
"think": {
"config": {
"laradumps": "config/config.php"
}
}
}
}
205 changes: 205 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
<?php

use think\facade\Env;

return [

/*
|--------------------------------------------------------------------------
| Host
|--------------------------------------------------------------------------
|
| Dumps App Host address. By default: '127.0.0.1',
| Uncomment the line below according to your environment.
|
*/

'host' => Env::get('laradumps.DS_APP_HOST', '127.0.0.1'),

//'host' => 'host.docker.internal', //Docker on Mac or Windows
//'host' => '127.0.0.1', //Homestead with the VirtualBox provider,
//'host' => '10.211.55.2', //Homestead with the Parallels provider,

/*
|--------------------------------------------------------------------------
| Port
|--------------------------------------------------------------------------
|
| Dumps App port. By default: 9191
|
*/

'port' => Env::get('laradumps.DS_APP_PORT', 9191),

/*
|--------------------------------------------------------------------------
| Auto Invoke Desktop App
|--------------------------------------------------------------------------
|
| Invoke LaraDumps Desktop App to gain focus when a new dump arrives.
|
*/

'auto_invoke_app' => Env::get('laradumps.DS_AUTO_INVOKE_APP', true),

/*
|--------------------------------------------------------------------------
| SQL Query dump
|--------------------------------------------------------------------------
|
| When `true`, it allows to dump database and send them to Desktop App.
| Required for: ds()->queriesOn() method.
|
*/

'send_queries' => Env::get('laradumps.DS_SEND_QUERIES', false),

/*
|--------------------------------------------------------------------------
| Log dump
|--------------------------------------------------------------------------
|
| When `true`, it allows to dump Laravel logs and send them to Desktop App.
| Required for logs dumping.
|
*/

'send_log_applications' => Env::get('laradumps.DS_SEND_LOGS', false),

'auto_clear_on_page_reload' => Env::get('laradumps.DS_AUTO_CLEAR_ON_PAGE_RELOAD', false),

/*
|--------------------------------------------------------------------------
| Preferred IDE
|--------------------------------------------------------------------------
|
| Configure your preferred IDE to be used in Dumps App file links.
|
*/

'preferred_ide' => Env::get('laradumps.DS_PREFERRED_IDE', 'phpstorm'),

/*
|--------------------------------------------------------------------------
| IDE Handlers
|--------------------------------------------------------------------------
|
| Dumps already ships with pre-configured IDE protocol handlers.
| You may adjust the handler or include custom ones, if needed.
|
*/

'ide_handlers' => [
'atom' => [
'handler' => 'atom://core/open/file?filename=',
'line_separator' => '&line=',
],
'phpstorm' => [
'handler' => 'phpstorm://open?file=',
'line_separator' => '&line=',
],
'sublime' => [
'handler' => 'subl://open?url=file://',
'line_separator' => '&line=',
],
'vscode' => [
'handler' => 'vscode://file/',
'line_separator' => ':',
],
'vscode_remote' => [
'handler' => 'vscode://vscode-remote/',
'line_separator' => ':',
'local_path' => 'wsl+' . Env::get('laradumps.DS_PREFERRED_WSL_DISTRO', 'Ubuntu20.04LTS'),
'remote_path' => Env::get('laradumps.DS_REMOTE_PATH', null),
'work_dir' => Env::get('laradumps.DS_WORKDIR', '/var/www/html'),
],
],

/*
|--------------------------------------------------------------------------
| Ignore Routes
|--------------------------------------------------------------------------
|
| Routes containing the words listed below will NOT be dumped with
| ds()->routes() command.
|
*/

'ignore_route_contains' => [
'debugbar',
'ignition',
'horizon',
'livewire',
],

/*
|--------------------------------------------------------------------------
| Sleep
|--------------------------------------------------------------------------
|
| You can specify an interval in 'seconds' between sending dumps
| to the Desktop App.
|
*/

'sleep' => Env::get('laradumps.DS_SLEEP'),

/*
|--------------------------------------------------------------------------
| Color in Screen
|--------------------------------------------------------------------------
|
| If true, LaraDumps will separate colors into screens with the name of the
| submitted color.
|
*/

'send_color_in_screen' => Env::get('laradumps.DS_SEND_COLOR_IN_SCREEN', false),

/*
|--------------------------------------------------------------------------
| Color in Screen - Color Map
|--------------------------------------------------------------------------
|
| Color map for "Color in Screen" feature.
|
*/

'screen_btn_colors_map' => [
'default' => [
'default' => 'btn-white',
],
'danger' => [
'default' => 'btn-danger',
],
'info' => [
'default' => 'btn-info',
],
'success' => [
'default' => 'btn-success',
],
'warning' => [
'default' => 'btn-warning',
],
],

/*
|--------------------------------------------------------------------------
| Level Log Colors Map
|--------------------------------------------------------------------------
|
| Definition of Tailwind CSS class for LaraDumps color tag.
|
*/

'level_log_colors_map' => [
'error' => Env::get('laradumps.DS_LOG_COLOR_ERROR', 'bg-red-600'),
'critical' => Env::get('laradumps.DS_LOG_COLOR_CRITICAL', 'bg-red-600'),
'alert' => Env::get('laradumps.DS_LOG_COLOR_ALERT', 'bg-red-600'),
'emergency' => Env::get('laradumps.DS_LOG_COLOR_EMERGENCY', 'bg-red-600'),
'warning' => Env::get('laradumps.DS_LOG_COLOR_WARNING', 'bg-orange-300'),
'notice' => Env::get('laradumps.DS_LOG_COLOR_NOTICE', 'bg-blue-300'),
'info' => Env::get('laradumps.DS_LOG_COLOR_INFO', 'bg-gray-300'),
],

];
Empty file added src/.gitkeep
Empty file.
Loading

0 comments on commit ce7e264

Please sign in to comment.