socoladaica / laravel-audit
该包的最新版本(1.3.2)没有提供许可证信息。
该包的官方仓库似乎已不存在,因此该包已被冻结。
1.3.2
2023-02-19 22:54 UTC
Requires
- ext-json: *
- composer/class-map-generator: *
- composer/composer: ^1.6|^2.2
- doctrine/dbal: ^3.5
- friendsofphp/php-cs-fixer: ^v2.19.3|^v3.8.0
- icanhazstring/composer-unused: ^0.8.5
- larswiegers/laravel-translations-checker: ^v0.4
- nunomaduro/larastan: ^2.3
- phpunit/php-code-coverage: *
- phpunit/phpunit: *
- rector/rector: ^0.15.1
- socoladaica/laravel-badassium: *
- spatie/once: ^2.2
- spaze/phpstan-disallowed-calls: ^2.2
Suggests
- barryvdh/laravel-debugbar: PHP Debugbar integration for Laravel
- larswiegers/laravel-translations-checker: Get direct feedback where and what translations you are missing!
- mouadziani/laravel-query-inspector: The missing laravel helper that allows you to ispect your eloquent queries with their binding parameters
- nikic/php-parser: A PHP parser written in PHP
- nunomaduro/phpinsights: Analysis of code quality and coding style
- opcodesio/log-viewer: You will no longer need to read the raw Laravel log files trying to find what you're looking for
- propaganistas/laravel-disposable-email: Disposable email validator
- sarfraznawaz2005/indexer: Laravel Indexer
- spatie/laravel-mail-preview: A mail driver to quickly preview mail
- spatie/laravel-model-info: Using this package you can determine which attributes and relations your model classes have.
- squizlabs/php_codesniffer: PHP_CodeSniffer is a set of two PHP scripts
README
安装
composer require socoladaica/laravel-audit
更新 phpunit.xml
在 testsuites
中添加 testsuite
<testsuite name="Audit"> <directory suffix="Test.php">./vendor/socoladaica/laravel-audit/src/TestCases</directory> </testsuite>
<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true"> <testsuites> <testsuite name="Audit"> <directory suffix="Test.php">./vendor/socoladaica/laravel-audit/src/TestCases</directory> </testsuite> <testsuite name="Unit"> <directory suffix="Test.php">./tests/Unit</directory> </testsuite> <testsuite name="Feature"> <directory suffix="Test.php">./tests/Feature</directory> </testsuite> </testsuites> <filter> <whitelist processUncoveredFilesFromWhitelist="true"> <directory suffix=".php">./app</directory> </whitelist> </filter> <php> <server name="APP_ENV" value="testing"/> <server name="BCRYPT_ROUNDS" value="4"/> <server name="CACHE_DRIVER" value="array"/> <server name="DB_CONNECTION" value="sqlite"/> <server name="DB_DATABASE" value=":memory:"/> <server name="MAIL_DRIVER" value="array"/> <server name="QUEUE_CONNECTION" value="sync"/> <server name="SESSION_DRIVER" value="array"/> </php> </phpunit>
vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases"
测试用例
确保在运行任何测试用例之前运行 composer dumpautoload
vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\App\\Http\\ControllersTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\App\\Http\\RequestsTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\App\\Models\\ModelTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\App\\Models\\PivotTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Common\\ClassTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\ConfigsTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Database\\DatabaseTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Database\\MigrationsTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\EnvTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Psr\\Psr1Test" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Resources\\LangTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Resources\\SCSSTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\Resources\\ViewsTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\RoutesTest" vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases\\DotFileTest"
代码修复器
Composer 未使用
https://github.com/composer-unused/composer-unused
vendor\bin\composer-unused
Php-cs-fixer
vendor\bin\php-cs-fixer.bat --config=.php_cs.php fix vendor\bin\php-cs-fixer.bat --config=vendor/socoladaica/laravel-audit/.php_cs.php fix vendor\bin\php-cs-fixer.bat --config=vendor/socoladaica/laravel-audit/.php_cs.php fix Modules ..\labs\laravel-audit\vendor\bin\php-cs-fixer.bat --config=..\labs\laravel-audit\.php_cs.php fix ..\labs\laravel-audit\vendor\bin\php-cs-fixer.bat --config=..\labs\laravel-audit\.php_cs.php fix php ..\labs\laravel-audit\fix-phpcs.php
Rector
vendor\bin\rector --config=rector.php process vendor\bin\rector --config=vendor/socoladaica/laravel-audit/rector.php process ..\labs\laravel-audit\vendor\vendor\bin\rector --config=..\labs\laravel-audit\rector.php process ..\labs\laravel-audit\vendor\vendor\bin\rector --config=..\labs\laravel-audit\rector.php process
Phpstan
在项目根目录下创建 phpstan.neon
includes: - ./vendor/socoladaica/laravel-audit/audit.neon parameters: paths: - app # The level 9 is the highest level level: 5 ignoreErrors: - '#PHPDoc tag @var#' excludePaths: - ./*/*/FileToBeExcluded.php checkMissingIterableValueType: false
vendor\bin\phpstan analyse
vendor\bin\phpstan analyse -c audit.neon vendor\bin\phpstan analyse -c vendor/socoladaica/laravel-audit/audit.neon Modules
翻译检查器
php artisan translations:check
php artisan translations:check --directory=resources/lang
php artisan translations:check --directory=lang
php artisan translations:check --directory=Modules/*/resources/lang
php artisan translations:check --directory=Modules/lang
php artisan cms:audit:lang
blade-formatter
cd vendor\socoladaica\laravel-audit
npm i
cd ../../../
vendor\socoladaica\laravel-audit\node_modules\.bin\blade-formatter resources/**/*.blade.php --w --wrap 999999999999
vendor\socoladaica\laravel-audit\node_modules\.bin\blade-formatter Modules/**/resources/**/*.blade.php --w --wrap 0
vendor\socoladaica\laravel-audit\node_modules\.bin\blade-formatter resources/views/layouts/**/*.blade.php --w --wrap 999999999999
即将推出
- 请求
- 测试缺少 addCustomValues
- date_from 添加自定义值 today, yesterday
- 规则缺少类型
- attributeShouldNotExists
- 而是,规则(between instead min max)
- 遵循类型 digits_between
- 存在
- 缺少软删除
- 模型不存在
- 重复规则
- 类型转换
- 请求软删除
- 测试缺少 addCustomValues
- 模型
- 关系使用 pivot 类而不是表字符串
- 列名使用 snake_case
- 拆分大型模型
- pivot 名称
- 测试关系外键
- 关系应该是索引
- 使用 pivot 而不是表字符串
- 缺少类型转换
- 迁移
- 测试可以回滚
- 测试迁移与数据库设计匹配
- 测试外键
- 类型转换
- 控制器
- 只有公开的资源方法
- 路由
- 路由使用 kebab-case
- 不要使用闭包回调
- 使用 FormRequest 而不是 Request
- 控制器方法未找到
- 请求匹配控制器
- 方法更新应该使用 put 或 patch
- 删除空操作的路线
- 资源
- resources/lang
- 键使用 snake_case
- resources/assets
- 使用
mix.scripts
替换mix.copy
- 使用
- resources/views
- 使用
{{ URL::asset() }}
替换!! URL::asset() !!}
- 使用
- 数据库
- 列不应该为空
- 列应该是无符号的
- 列不应该为负
- 存储:
- chmod
- 公共
- chmod
- 点文件
- 测试 .gitignore
- 其他
- 删除所有 todo
- 项目设置
- vimeo/psalm
- browserlint
- carbon comparerDate
- 应使用 laravel Carbon
- 不要使用外部 URL
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- 添加删除事务日志
- document.on insteam element.{event}
- 自定义 404
- https://codepen.io/knolcoder/pen/ZEewZaY
- https://stackoverflow.com/questions/35774500/如何在Bootstrap模态框关闭后移除按钮的焦点
- https://stackoverflow.com/questions/30322918/bootstrap-modal在关闭时恢复按钮的焦点
- 检查CSS支持
- 了解有关zero字符的信息
- https://github.com/shufo/blade-formatter
- 定位请求 https://github.com/laravel/framework/compare/02fdd82690...503f6e280c
- 当存在子关系时不允许删除
- 尝试正确的捕获方式
- 在whereDate之前检查格式
- https://github.com/ash-jc-allen/laravel-config-validator
- https://news.laravel.net.cn/laravel-n1-query-problems
- https://news.laravel.net.cn/disable-eloquent-lazy-loading-during-development
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
- [ ]
开发
composer.json
{ "requred-dev": { "socoladaica/laravel-audit": "dev-develop" }, "repositories": [ { "type": "path", "url": "../socola-cms-demo-v2/cms-dev/laravel-audit" } ], }
"repositories": [ { "type": "path", "url": "../labs/laravel-audit" } ],
composer require socoladaica/laravel-audit:dev-develop --dev
全部
vendor\bin\php-cs-fixer.bat --config=vendor/socoladaica/laravel-audit/.php_cs.php fix Modules vendor\bin\phpunit.bat --filter="SocolaDaiCa\\LaravelAudit\\TestCases" vendor\bin\paratest --filter="SocolaDaiCa\\LaravelAudit\\TestCases" vendor\bin\rector --config=vendor/socoladaica/laravel-audit/rector.php process Modules/laravel-audit vendor\bin\phpcs --colors Modules\*