承接 nucleardog/ndapi-debug 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nucleardog/ndapi-debug

最新稳定版本:v1.0.0

Composer 安装命令:

composer require nucleardog/ndapi-debug

包简介

API boilerplate for Laravel - debug tools

README 文档

README

Part of the ndapi package. Provides a system for registering and reporting on application diagnostics meant for dev-time debugging.

Usage

Artisan Command

This package provides an artisan command to report on diagnostic checks:

Syntax:
$ artisan ndapi:diagnose [options]

Available options are:

  • -a: Also report passing checks.
  • --json: Render output as JSON

Example:

$ artisan ndapi:diagnose -a

exceptionHandler
Discovered Exception Response classes ............................ [PASS]
     responses                            AuthenticationExceptionResponse
                                           AuthorizationExceptionResponse
                                                        ExceptionResponse
                                           ModelNotFoundExceptionResponse
                                            NotFoundHttpExceptionResponse
                                              ValidationExceptionResponse


responses
Discovered Response classes ...................................... [PASS]
     responses                                                   accepted
                                                                  created
                                                                    error
                                                                     fail
                                                                  success
ResponseFactory is macroable ..................................... [PASS]


support
Discovered helper classes ........................................ [PASS]
     helpers                          Nucleardog\Api\Support\ArrayHelpers
                                     Nucleardog\Api\Support\StringHelpers

$

Implementing Diagnostics

You can:

  1. Implement the Nucleardog\Api\Contracts\Debug\Diagnostic contract and register your Diagnostic with the DiagnosticsManager class.
  2. Register a closure with the DiagnosticsManager returning a DiagnosticResult.
  3. Wrap your closure in the provided SimpleDiagnostic wrapper which handles translating various types of results into a properly formatted DiagnosticResult.

In any case, you can then register the Diagnostic by:

  1. If you have implemented the Diagnostic contract, it will be discovered and registered automatically.
  2. Use the service container: app()->make(DiagnosticsManager::class)->add($diagnostic);
  3. Use the facade: \Nucleardog\Api\Support\Facades\Diagnostics::add($diagnostic);

Tests

Phpunit is included in a separate composer file and must be explicitly installed:

$ cd tools/phpunit/
$ composer install

Once installed, the tests can be run from the root package folder with:

$ composer test

Legal

Copyright 2024 Adam Pippin hello@adampippin.ca

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-11-25