Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: thinkphp container 兼容 #669

Open
3 of 4 tasks
yansongda opened this issue Sep 4, 2022 · 5 comments · May be fixed by #675
Open
3 of 4 tasks

feat: thinkphp container 兼容 #669

yansongda opened this issue Sep 4, 2022 · 5 comments · May be fixed by #675

Comments

@yansongda
Copy link
Owner

yansongda commented Sep 4, 2022

  • 没有 set 方法,可以用 bind 等代替?
  • bind 后,执行 force 时,再次 bind 不生效,需要在 bind 前 delete 下
  • Pay 中如果未提前 bindget 时 必定失败,并不会自动注入新增
  • Pipeline 中如果未提前 bindget 时 必定失败,并不会自动注入新增
@yansongda yansongda linked a pull request Sep 8, 2022 that will close this issue
@axguowen
Copy link

可以试试使用instance方法来绑定一个类实例到容器

@yansongda
Copy link
Owner Author

yansongda commented Oct 23, 2023

可以试试使用instance方法来绑定一个类实例到容器

这周我再看看 tp 那边能否兼容了。

PS:如果感兴趣的化,也可以 PR 进来

@axguowen
Copy link

可以试试使用instance方法来绑定一个类实例到容器

这周我再看看 tp 那边能否兼容了。

PS:如果感兴趣的化,也可以 PR 进来

试了下好像还是不行,TP的Contanier有限制,必须是绑定了标识的类才能获取到
然而使用官方推荐的安装hyperf/pimple包会导致TP的助手函数env不能正常获取到环境变量,
所以卸载了hyperf/pimple之后安装illuminate/container包也能用,且不影响TP的env助手函数的使用

不知道在其它框架或者无框架的项目使用illuminate/container容器能不能用,如果可以用的话感觉都不需要hyperf/pimple包了,这个包稍微有点臃肿,可以直接改用illuminate/container容器替代

@yansongda
Copy link
Owner Author

然而使用官方推荐的安装hyperf/pimple包会导致TP的助手函数env不能正常获取到环境变量,

这个安装 hyperf/pimple 最新版的就行

不知道在其它框架或者无框架的项目使用illuminate/container容器能不能用,如果可以用的话感觉都不需要hyperf/pimple包了,这个包稍微有点臃肿,可以直接改用illuminate/container容器替代

illuminate/container 也可以用的。两个包其实都不臃肿,也都挺简单的,可以看看源码就知道了。不过看选择吧。我晚些时候可以改改文档,增加下,给多一个选择

@80boys

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants