Laravel 包:发现解决

Posted

技术标签:

【中文标题】Laravel 包:发现解决【英文标题】:Laravel package:discover resolve 【发布时间】:2018-06-04 14:52:37 【问题描述】:

如何从我的项目 laravel 中解析发现包?

composer update

使用包信息加载作曲家存储库 更新依赖项(包括 require-dev) 无需安装或更新 生成优化的自动加载文件 Illuminate\Foundation\ComposerScripts::postAutoloadDump

@php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: gloudemans/shoppingcart
Discovered Package: htmlmin/htmlmin
Discovered Package: mews/purifier
Discovered Package: rap2hpoutre/laravel-log-viewer
Discovered Package: roumen/sitemap
Discovered Package: laravel/socialite
Discovered Package: spatie/laravel-image-optimizer
Discovered Package: aloha/twilio
Discovered Package: laravel/tinker
Discovered Package: socialiteproviders/manager
Discovered Package: davejamesmiller/laravel-breadcrumbs
Package manifest generated successfully.

作曲家.json:


"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": 
    "php": ">=7.0.0",
    "aloha/twilio": "^3.0",
    "davejamesmiller/laravel-breadcrumbs": "^4.2",
    "fideloper/proxy": "^3.3",
    "gloudemans/shoppingcart": "^2.4",
    "golonka/bbcodeparser": "^2.2",
    "htmlmin/htmlmin": "^5.0",
    "kim/activity": "^1.1",
    "laravel/framework": "5.5.*",
    "laravel/socialite": "^3.0",
    "laravel/tinker": "~1.0",
    "mews/purifier": "^2.0",
    "rap2hpoutre/laravel-log-viewer": "^0.11.0",
    "roumen/sitemap": "^2.7",
    "socialiteproviders/vkontakte": "^3.0",
    "spatie/laravel-image-optimizer": "^1.1"
,
"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

如何解决这个问题?我有包裹。但是为什么要发现写呢?如何解决发现的包?

【问题讨论】:

向我们展示您的作曲家文件。 准备好了。请看。 【参考方案1】:

如果下一个版本与您项目中的其他库冲突或您的 composer.json 中有确切版本,则无法更新。

Laravel 有自己的composer.json,它描述了类似的库版本(它是我的 Laravel 5.4 的 json):

    "symfony/console": "~3.2", // ~3.2 means 3.2 ONLY
    "symfony/debug": "~3.2",
    "symfony/finder": "~3.2",
    "symfony/http-foundation": "~3.2",

统治作曲家的是composer.json

【讨论】:

以上是关于Laravel 包:发现解决的主要内容,如果未能解决你的问题,请参考以下文章

Laravel套餐:发现决心

测试一个 Laravel 包

使用作曲家安装 Laravel 4 包

laravel扩展包服务提供者的注册的两种方式

laravel composer install 无法解决 tymon/jwt-auth 的可安装包

无法将 Jetstream 包安装到 Laravel 项目