简体   繁体   English

尝试在laravel中使用composer软件包

[英]Trying to use a composer package in laravel

Im using Laravel 5.8. 我正在使用Laravel 5.8。 Im trying to use the following package https://packagist.org/packages/s1lentium/iptools 我正在尝试使用以下软件包https://packagist.org/packages/s1lentium/iptools

To install it i have run: 要安装它,我已经运行:

composer require s1lentium/iptools 作曲家需要s1lentium / iptools

Confirmed the require line is in the composer.json "s1lentium/iptools": "^1.1" 确认要求行在composer.json“ s1lentium / iptools”中:“ ^ 1.1”

and that the package is in "vendor/s1lentium/iptools/" 并且该软件包位于“ vendor / s1lentium / iptools /”中

How can i reference it in the code (controller or even in a view)?? 我如何在代码中引用它(控制器甚至在视图中)? When I try to use the IP class Laravel cannot find it. 当我尝试使用IP类时,Laravel无法找到它。

I've researched a lot and but without success. 我研究了很多,但没有成功。 Hope anyone can lead me to the correct step. 希望任何人都可以带领我迈出正确的一步。

Thanks! 谢谢!

Run composer dump-autoload 运行composer dump-autoload

You must call the IP class with \\IPTools\\IP , or use it: 您必须使用\\IPTools\\IP调用IP类,或use它:

use IPTools\IP;

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM