xpyct/sql-viewer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xpyct/sql-viewer

最新稳定版本:1.2.0

Composer 安装命令:

composer require xpyct/sql-viewer

包简介

SQL Viewer for Laravel

README 文档

README

SQL Viewer for Laravel

Requirements | Installation | Usage

sql-viewer

Documentation

Documentation can be found on the official website.

Get Started

Requirements

  • PHP 8.0+
  • Laravel 8+

Installation

To install the package via composer, Run:

composer require xpyct/sql-viewer

After installing the package, publish the front-end assets by running:

php artisan sql-viewer:install

This is the content that will be published to config/sql-viewer.php

return [
    /*
     * By default this package will only run in local development.
     * Do not change this, unless you know what your are doing.
     */
    'enabled' => env('SQL_VIEWER_ENABLED', env('APP_ENV') === 'local'),

    /*
     * The SqlViewer page will be available on this path.
     */
    'path' => env('SQL_VIEWER_PATH', 'sql-viewer'),

    /*
    * These middleware will be assigned to every SqlViewer route, giving you the chance
    * to add your own middlewares to this list or change any of the existing middleware.
    */
    'middleware' => [
        'web',
        // Uncomment this if you want to add auth middleware
        // 'auth',
    ],

    /*
     * Forbidden actions in SQL queries
     */
    'forbidden_actions' => [
        'DROP',
        'TRUNCATE',
        'DELETE',
        'CREATE',
    ],

    /*
     * Maximum number of rows that can be returned from a query (add it to the LIMIT clause)
     */
    'max_limit' => 100,
];

Usage

Once the installation is complete, you will be able to access SQL Viewer directly in your browser.

By default, the application is available at: {APP_URL}/sql-viewer.

Authorization

To authorize, add your email to the sql-viewer config and set enabled variable.

You can register a viewSqlViewer gate with your own logic. A good place to do this is in the AuthServiceProvider that ships with Laravel.

public function boot()
{
    Gate::define('viewSqlViewer', function ($user = null) {
        return true;
    });
}

Credits

License

The MIT License (MIT).

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: TypeScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-01