定制 jnbn/composer-json-fixer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jnbn/composer-json-fixer

Composer 安装命令:

composer require jnbn/composer-json-fixer

包简介

A tool for fixing and cleaning up `composer.json` file according to its schema and best practices.

README 文档

README

Latest Stable Version PHP Version License Build Status Code coverage

A tool for fixing and cleaning up composer.json file according to its schema and best practices.

Installation

composer.json fixer can be installed globally:

composer global require jnbn/composer-json-fixer

or as a dependency (e.g. to include into CI process):

composer require --dev jnbn/composer-json-fixer

Usage

Run and fix:

vendor/bin/composer-json-fixer

See diff of potential fixes:

vendor/bin/composer-json-fixer --dry-run

Upgrade dependencies with composer require:

vendor/bin/composer-json-fixer --upgrade

Fixers

  • composer keys lowercase - changes names of properties to lowercase
  • autoload - fixes paths and sorts autoload and autoload-dev
  • config - sorts config by key
  • keywords - sorts keywords by value
  • license - adds license if it is missing
  • minimum stability - removes minimum-stability if it has default value ("stable")
  • name - makes package name lowercase
  • repositories - sorts repositories
  • require - cleans up versions for require and require-dev
  • version - removes version if it is present
  • composer keys sorting - sorts properties according to the documentation

Example

Before running composer-json-fixer:

{
    "name": "JohnDoe/FooBar",
    "version": "v1.0.0",
    "type": "library",
    "description": "A library to do something cool",
    "keywords": [
        "cool",
        "awesome stuff"
    ],
    "require-dev": {
        "phpunit/phpunit": "^5.7 | ^6.5"
    },
    "require": {
        "symfony/finder": "^2.7|^3.4|^4",
        "symfony/yaml": ">= 2.7"
    },
    "minimum-stability": "stable",
    "autoload": {
        "psr-4": {
            "FooBar": "src"
        }
    }
}

After:

{
    "name": "johndoe/foobar",
    "description": "A library to do something cool",
    "type": "library",
    "keywords": [
        "awesome stuff",
        "cool"
    ],
    "license": "proprietary",
    "require": {
        "symfony/finder": "^2.7 || ^3.4 || ^4",
        "symfony/yaml": ">=2.7"
    },
    "require-dev": {
        "phpunit/phpunit": "^5.7 || ^6.5"
    },
    "autoload": {
        "psr-4": {
            "FooBar\\": "src/"
        }
    }
}

Exit status

  • 0 - composer.json file does not require fixing,
  • 1 - composer.json file can be, or was fixed,
  • 2 - exception was thrown.

Contributing

Request a feature or report a bug by creating issue.

Alternatively, fork the repo, develop your changes, regenerate README.md:

src/Readme/run > README.md

make sure all checks pass:

composer check

and submit a pull request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固