PHP组件中必须有composer.json文件,而且这个文件的内容必须是有效的JSON,Composer会使用这个文件中的信息查找、安装和自动加载PHP组件。composer.json文件还包含组件在Packagist目录中的信息。
{
"name": "modernphp/scnner",
"description": "Scan URLs a CSV file and report inaccessible URLs",
"keywords": ["url", "scanner", "csv"],
"homepage": "http://example.com",
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"homepage": "https://github.com/codeguy",
"role": "Developer"
}
],
"support": {
"email": "help@example.com"
},
"require": {
"php": ">=5.4.0",
"guzzlehttp": "~5.0"
},
"require-dev": {
"phpunit/phpunit" : "~5.0"
},
"suggest": {
"league/csv": "~6.0"
},
"autoload": {
"psr-4": {
"Oreilly\\ModernPHP": "src/"
}
}
}