V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
pinews
V2EX  ›  PHP

新手请教 composer 2 个项目依赖怎么合并?

  •  
  •   pinews · 2020-06-09 10:27:34 +08:00 · 2044 次点击
    这是一个创建于 1630 天前的主题,其中的信息可能已经有所发展或是发生改变。
    不懂怎么表达,就是我现在要做一个东西要用 easyswoole 和激光 im,两边的代码都有了,怎么放在一起?自动加载两边的依赖?
    5 条回复    2020-06-09 12:01:34 +08:00
    pinews
        1
    pinews  
    OP
       2020-06-09 10:29:20 +08:00
    es 的 json
    {
    "autoload": {
    "psr-4": {
    "App\\": "App/"
    }
    },
    "require": {
    "easyswoole/easyswoole": "3.3.7"
    }
    }
    jg 的 json
    {
    "name": "jiguang/jmessage",
    "type": "library",
    "version": "1.1.13",
    "description": "JMessage's officially supported PHP client library for accessing JMessage APIs.",
    "keywords": ["jiguang", "jmessage", "API Client"],
    "homepage": "https://github.com/jpush/jmessage-api-php-client",
    "license": "MIT",
    "authors": [
    {
    "name": "JiGuang",
    "email": "[email protected]",
    "homepage": "https://www.jiguang.cn"
    }
    ],
    "require": {
    "php": ">=5.4",
    "ext-curl": "*"
    },
    "autoload" : {
    "psr-4": {"JMessage\\": "src/JMessage/"}
    }
    }
    littleylv
        2
    littleylv  
       2020-06-09 10:40:16 +08:00
    自己写一个 composer.json
    {
    "require": {
    "easyswoole/easyswoole": "^3.3.0",
    "jiguang/jmessage": "^1.1.0"
    }
    }

    然后 composer install
    pinews
        3
    pinews  
    OP
       2020-06-09 10:48:40 +08:00
    @littleylv 好的 谢谢
    cvl
        4
    cvl  
       2020-06-09 11:42:22 +08:00
    别忘了这句
    "psr-4": {"JMessage\\": "src/JMessage/"}
    pinews
        5
    pinews  
    OP
       2020-06-09 12:01:34 +08:00
    我在 esayswoole 的默认 composer.json 下加了"jiguang/jmessage": "^1.1.0",后提示
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
    Nothing to install or update
    Generating autoload files

    怎么办?小白一枚,composer 的文档看了 看不明白。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1623 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 16:54 · PVG 00:54 · LAX 08:54 · JFK 11:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.