使用 composer 无法安装 thinkphp 低版本依赖

2025年12月16日服务端开发1 39,344字数 695阅读2分19秒阅读模式

公司服务器一直在用 php7.4,最近的项目如果依赖 thinkphp 的,使用 composer install 总是会报错:

Your requirements could not be resolved to an installable set of packages.

上一次使用 php8.5 安装了一个项目,确实没有这个问题,但是框架中一堆旧代码需要手动修改,就很扯,所以这一次决定无论如何,也要解决这个问题。

最近发现 ai 用习惯了,都不知道如何解决问题了。

这次特意留意看了下命令行中的错误提示:

  Problem 1
    - Root composer.json requires topthink/framework ^6.0.0, found topthink/framework[v6.0.0, ..., v6.1.5] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("PKSA-wpgp-v5cy-4kds") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

其实大概看下,就知道解法,因为提示明确说了,你可以关闭这个安全特性,只要在 audit 配置中,设置 block-insecurefalse 即可。

根据提示,修改下 composer.json 文件,添加对应配置:

image-20251216123834369

再用 composer install安装,thinkphp 6.1 也可以正常被安装了。

image-20251216123945300

如何让ThinkPHP从V3.2升级到V5.0+版本 服务端开发

如何让ThinkPHP从V3.2升级到V5.0+版本

公司最近终于开始计划升级下 ThinkPHP 版本了。 不过由于PHP版本的限制,只是升级到了6,所以在这里总结下经验。 快速替换指南 这里提供我在升级过程中替换掉的助手函数,不在这里的可以参考文章底...
如何在macOS上安装Composer 技巧分享

如何在macOS上安装Composer

如果是搞PHP开发的,应该很难避开Composer这个包管理工具,只需要简单的命令就可以实现包的添加、升级或者移除。 那么在macOS上该如何安装这个Composer呢? 通过Brew安装 最简单的做...
评论  1  访客  1
    • asd 8

      敢用8.5的都是猛人现在

    发表评论

    匿名网友

    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

    确定