1
我在Laravel 5.5
中構建了一個軟件包。現在我想在我自己的項目中使用該包 本地。Laravel在自己的項目中使用軟件包
從我的包中的composer.json看起來是這樣的:
{
"name": "larsjanssen6/underconstruction",
"license": "MIT",
"homepage": "https://github.com/larsjanssen6/underconstruction",
"authors": [
{
"name": "Lars Janssen",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php" : "^7.0",
"illuminate/support": "~5.5.0"
},
"autoload": {
"psr-4": {
"LarsJanssen\\underconstruction\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
"LarsJanssen\\underconstruction\\UnderConstructionServiceProvider"
]
}
}
}
(https://github.com/larsjanssen6/underconstruction)
在我已經添加了包像這樣在我composer.json文件中的新鮮laravel項目:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/larsjanssen6/underconstruction"
}
],
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"larsjanssen6/underconstruction": "master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
但我收到此錯誤:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package larsjanssen6/underconstruction could not be found in any version, there may be a typo in the package name.
這裏有什麼問題?
你是哪裏發佈你的軟件包? Git的?你是否像packagist配置了一些軟件包倉庫?我找不到。 –
是的,它在git上:https://github.com/larsjanssen6/underconstruction。在我的文章的第二個代碼塊中,您可以看到我配置了'repositories'。 – Jenssen
你需要重新提交'dev-master'(如果你想要一個沒有標籤的分支或GitHub的行話發佈,總是用'dev-'開頭)。 – Kyslik