laravel-audit/package 问题修复 & 功能扩展

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

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

laravel-audit/package

Composer 安装命令:

composer require laravel-audit/package

包简介

Extensible Laravel code audit package with Pint, PHPStan/Larastan, and purpose-built analyzers.

README 文档

README

Extensible Laravel audit package inspired by Laravel-focused tools such as ShieldCI. It combines Laravel-specific analyzers with optional Pint and PHPStan/Larastan runners.

Installation

composer require laravel-audit/package --dev

Publish the configuration when you need to tune paths, tools, or rules:

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

Usage

php artisan audit:analyze
php artisan audit:analyze --format=json
php artisan audit:analyze --format=sarif --fail-on=warning
php artisan audit:analyze --only=security,performance
php artisan audit:analyze --no-tools

The command returns a non-zero exit code when an issue meets the configured fail_on threshold.

When Larastan is installed in the target project and no phpstan.neon / phpstan.neon.dist exists, the PHPStan runner automatically generates a temporary Larastan configuration using laravel-audit.paths and tools.phpstan.level. Disable this with tools.phpstan.auto_larastan => false or LARAVEL_AUDIT_PHPSTAN_AUTO_LARASTAN=false.

Built-In Categories

  • security: raw SQL, mass assignment, weak validation, debug defaults.
  • performance: N+1 candidates and synchronous heavy jobs.
  • reliability: missing transaction candidates and env() outside config.
  • best-practices: inline validation and large controllers.
  • code-quality: long methods, large classes, redundant guards, boolean returns, null coalesce fallbacks, empty foreach guards, catch/rethrow blocks, and else-after-exit nesting.
  • tooling: Pint and PHPStan/Larastan findings.

Adding Analyzers

Implement LaravelAudit\Analysis\AnalyzerInterface, return normalized Issue objects, and register the analyzer in AuditServiceProvider or a consuming app service provider.

Analyzers should report evidence and recommendations. If a rule cannot prove a defect statically, phrase the issue as a candidate or risk.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固