mydevnl/audit-routes 问题修复 & 功能扩展

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

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

mydevnl/audit-routes

Composer 安装命令:

composer require --dev mydevnl/audit-routes

包简介

Gain insights into the security and protection of your Laravel routes. Audit Routes is your new best friend for keeping your application rock-solid!

README 文档

README

This PHP Package provides a streamlined approach to gaining insights into the security and protection of your application's routes. In just a few seconds, you can assess critical aspects such as:

  • Test Coverage: Comprehensive tests cover all routes to ensure reliability
  • Authentication: Routes requiring authentication are clearly identified
  • Scoped Bindings: Nested route models are scoped to maintain data integrity
  • Permissions: Permission or policy checks enforce access control
  • Middleware: Essential middleware is applied for security and request handling

Latest Stable Version Total Downloads Coding standards Tests License

Built for Laravel with extensible architecture for other PHP frameworks.

Requirements

  • PHP: 8.1+

Documentation

Comprehensive documentation is available to help you get the most out of Audit Routes:

Getting Started

Guides

Reference

  • API Documentation
    • Assertions - Integrate route security validation directly into your test suite
    • Auditors - Auditors are the core components that analyze your routes
    • Commands - Available Artisan Commands
  • Architecture
  • Examples

Community

  • FAQ - Frequently asked questions
  • Resources - Additional tools and resources

Quick Reference

Installation

You can install the package via Composer:

composer require mydevnl/audit-routes --dev

Optionally publish the configuration file:

php artisan vendor:publish --tag=audit-routes-config

Quick Start

Get your first audit running in seconds:

# Run a basic security audit
php artisan route:audit -vv

# Generate a detailed HTML report
php artisan route:audit-report

# Check authentication coverage
php artisan route:audit-auth -vv

For programmatic usage:

use MyDev\AuditRoutes\AuditRoutes;
use MyDev\AuditRoutes\Auditors\PolicyAuditor;
use MyDev\AuditRoutes\Auditors\MiddlewareAuditor;

$result = AuditRoutes::for($router->getRoutes())
    ->setBenchmark(50)
    ->run([
        PolicyAuditor::make()->setWeight(25),
        MiddlewareAuditor::make(['auth'])->setWeight(20),
    ]);

How It Works

Audit Routes uses a scoring system to evaluate route security:

  • Built-in Auditors: PolicyAuditor, MiddlewareAuditor, PhpUnitAuditor, and more
  • Configurable Weights: Customize importance of different security aspects
  • Benchmark System: Set minimum scores for compliance (routes below benchmark are flagged)
  • Multiple Outputs: Console, HTML reports, JSON exports for different workflows

Learn more about the Architecture and Auditor System.

Available Commands

The package provides several built-in commands to help you get started quickly:

  • route:audit - Comprehensive route security analysis
  • route:audit-report - Generate detailed HTML audit reports
  • route:audit-test-coverage - Analyze test coverage for routes
  • route:audit-auth - Focus on authentication middleware analysis

For detailed usage examples and command-line options, see the Basic Usage Guide.

Quick Reference

# Basic audit with detailed output
php artisan route:audit -vv

# High security standards
php artisan route:audit --benchmark 75 -vv

# Generate HTML report
php artisan route:audit-report

# Check authentication coverage
php artisan route:audit-auth -vv

# Verify test coverage
php artisan route:audit-test-coverage --benchmark 1 -vv

# Export results for CI/CD
php artisan route:audit --benchmark 50 --export json --filename security-audit.json

Testing Integration

The package includes PHPUnit assertions for integrating route security checks directly into your test suite. Use the AssertsAuditRoutes trait to enforce security standards as part of your CI/CD pipeline.

See the Testing Guide for comprehensive examples and best practices.

Troubleshooting

Common issues:

  • No routes found? Ensure your Laravel application has defined routes and clear route cache: php artisan route:clear
  • Permission errors? Check that storage/exports/audit-routes/ is writable: chmod -R 775 storage/
  • Configuration issues? Verify your config/audit-routes.php settings match your project structure

For detailed troubleshooting and solutions, see the Troubleshooting Guide or FAQ.

Contributing

We welcome contributions to this project! If you have ideas for improvements or find bugs, please submit them as issues on GitHub. We highly appreciate and encourage community participation.

For additional help or questions, feel free to reach out via GitHub issues.

Learn more about contributing.

Security Vulnerabilities

If you discover any security vulnerabilities, please report them immediately. All security-related issues will be addressed with the highest priority.

License

This package is open-sourced software licensed under the MIT license.

We're still in development

Please be aware that the most stable release is an beta release and may be unstable. The roadmap will be published soon. Follow mydevnl to stay updated!

May your routes be flawless! 🔒✨

mydevnl/audit-routes 适用场景与选型建议

mydevnl/audit-routes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「routing」 「security」 「testing」 「phpunit」 「routes」 「Metrics」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mydevnl/audit-routes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mydevnl/audit-routes 我们能提供哪些服务?
定制开发 / 二次开发

基于 mydevnl/audit-routes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-27