croustibat/php-check-for-laravel 问题修复 & 功能扩展

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

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

croustibat/php-check-for-laravel

最新稳定版本:v2.0.0

Composer 安装命令:

composer require croustibat/php-check-for-laravel

包简介

Interactive CLI tool to check and update outdated Composer dependencies

README 文档

README

Interactive & CI-friendly tool to check and update outdated Composer dependencies

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A standalone CLI tool that provides both an interactive mode for updating dependencies and a CI-ready mode for automated pipelines. Works with any PHP project, with optional Laravel integration.

Interactive Mode Demo

Features

  • Interactive Mode: Beautiful CLI with Laravel Prompts for manual updates
  • CI Mode: Non-interactive output with configurable exit codes
  • Multiple Formats: Table, JSON, or Markdown output
  • Security Checks: Integrates with composer audit
  • Flexible Filters: Filter by major, minor, or patch updates
  • Ignore List: Exclude specific packages from checks
  • Configurable: All options can be set via config file
  • Framework Agnostic: Works with any PHP project
  • Laravel Integration: Optional auto-discovered Artisan command

Installation

composer require croustibat/composer-check

That's it! The tool is ready to use immediately.

Usage

Standalone CLI (any PHP project)

vendor/bin/composer-check

This opens an interactive prompt where you can select which packages to update.

Laravel Integration

For Laravel projects, the package is auto-discovered. Use the Artisan command:

php artisan composer:check

Optionally publish the config file:

php artisan vendor:publish --tag="composer-check-config"

CI Mode

For use in CI/CD pipelines:

# Standalone
vendor/bin/composer-check --ci

# Laravel
php artisan composer:check --ci

Exit Codes

Code Meaning
0 All packages up to date (or check passed)
1 Outdated packages found (with --fail-on-* options)
2 Error (e.g., JSON parse failure)

Options

Option Description
--ci Run in non-interactive mode
--dev Include dev dependencies
--all Check all dependencies (not just direct)
--major-only Only show major updates
--minor-only Only show minor updates
--patch-only Only show patch updates
--format=<format> Output format: table, json, or markdown
--security Also check for security vulnerabilities
--fail-on-outdated Exit with code 1 if any packages are outdated
--fail-on-major Exit with code 1 if major updates exist
--ignore=<package> Packages to ignore (can be used multiple times)
--working-dir=<path> Working directory for composer commands

CI/CD Examples

GitHub Actions

name: Dependency Check

on:
  schedule:
    - cron: '0 9 * * 1'  # Every Monday at 9am
  workflow_dispatch:

jobs:
  check-dependencies:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'
      
      - name: Install dependencies
        run: composer install --no-interaction
      
      - name: Check for outdated packages
        run: vendor/bin/composer-check --ci --format=markdown >> $GITHUB_STEP_SUMMARY
      
      - name: Fail on major updates
        run: vendor/bin/composer-check --ci --fail-on-major

GitLab CI

dependency-check:
  stage: test
  script:
    - composer install --no-interaction
    - vendor/bin/composer-check --ci --fail-on-major --security
  only:
    - schedules

JSON Output for Custom Processing

vendor/bin/composer-check --ci --format=json

Output:

{
  "outdated": [
    {
      "name": "laravel/framework",
      "current": "10.0.0",
      "latest": "11.0.0",
      "semver": "major"
    }
  ],
  "summary": {
    "total": 1,
    "major": 1,
    "minor": 0,
    "patch": 0
  }
}

Configuration

Laravel Projects

Publish and edit the config file:

php artisan vendor:publish --tag="composer-check-config"
// config/composer-check.php

return [
    'include_dev' => false,
    'direct_only' => true,
    'check_security' => false,

    'ci' => [
        'format' => 'table',
        'fail_on_outdated' => false,
        'fail_on_major' => false,
    ],

    // Packages to exclude from checks
    'ignore' => [
        // 'vendor/package-name',
    ],
];

Standalone Projects

For non-Laravel projects, use command-line options to configure behavior:

# Include dev dependencies
vendor/bin/composer-check --dev

# Ignore specific packages
vendor/bin/composer-check --ignore=vendor/package1 --ignore=vendor/package2

# Check a different directory
vendor/bin/composer-check --working-dir=/path/to/project

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

croustibat/php-check-for-laravel 适用场景与选型建议

croustibat/php-check-for-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 82 次下载、GitHub Stars 达 5, 最近一次更新时间为 2023 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 croustibat/php-check-for-laravel 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-13