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
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
- Installation - Install and set up the package
- Quick Start - Get auditing in under 5 minutes
- Configuration - Customize settings and behavior
Guides
- Basic Usage - Essential patterns and common scenarios
- Advanced Usage - Complex configurations and custom scoring
- Custom Auditors - Build application-specific security checks
- Testing - PHPUnit assertions and CI integration
- CI Integration - Automate audits in your deployment pipeline
- Troubleshooting - Resolve common issues
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
- Auditor system - How the auditor system works internally
- Overview - Understanding the internal architecture
- Examples
- Integrations - Integrating with popular PHP frameworks
- Real world - Real-world implementation examples
Community
Quick Reference
- Quick Reference - Fast reference for commands and common patterns
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 analysisroute:audit-report- Generate detailed HTML audit reportsroute:audit-test-coverage- Analyze test coverage for routesroute: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.phpsettings 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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mydevnl/audit-routes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Testing Suite For Lumen like Laravel does.
Provide a way to secure accesses to all routes of an symfony application.
Write down your routing mapping at one place
It's a barebone security class written on PHP
The PHP SDK for Checkmango
Flight routing is a simple, fast PHP router that is easy to get integrated with other routers.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-27