GodziLaravel's avatar

how to know if a packeg is used in my app or not?

Hello

I did 'composer update' ans I got this message about some packages :

Nothing to install, update or remove
Package beyondcode/laravel-websockets is abandoned, you should avoid using it. No replacement was suggested.
Package laravelcollective/html is abandoned, you should avoid using it. Use spatie/laravel-html instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.

my question is how can I know if beyondcode/laravel-websockets is used in my app ?

0 likes
13 replies
martinbean's avatar

@godzilaravel Well are you using it?

I don’t really know how we’re expecting to answer this question for you. You installed the package, presumably because you wanted to use web sockets in your application. So you should be able to answer whether you’re using web sockets, and that package to facilitate that, or not.

GodziLaravel's avatar

@martinbean "You installed the package" !!! who says that ?? maybe I'm working on an existing project ?? isn't possible ?

martinbean's avatar

@GodziLaravel Regardless whether you’re working on a new project or not, you have the code in front of you, so you will have a better idea if a package is being used in your project or not.

How is a stranger on the Internet supposed to know if a package is being used by your project or not?

martinbean's avatar

@GodziLaravel You’re right: I don’t know the answer. And neither does any one else, because we have no idea about your project, its features, or what packages are/aren’t used. Y’know who would know those things, though? You, since you’re sat with the code in front of you on your computer screen that—again—me and other people can’t see.

martinbean's avatar

@GodziLaravel If you had put as much effort into looking at your own codebase as you do to tracking my character and word count, this thread would have been redundant 🙃

JussiMannisto's avatar

If you're not sure if a package is used in your code base directly, you can open the installed package from the vendor directory (e.g. vendor/laravelcollective/html), see which namespace it uses (e.g. Collective\Html) and then do a search in your project to see if that namespace is referenced somewhere. It's not a 100% foolproof way but should give you an idea.

But before that you should use composer why to see if it's required by some other package, as suggested by @truptman-solutions .

2 likes
Snapey's avatar

My understanding is that composer why will only tell you if the package is directly included in composer.json (you can see that) or if it was loaded as a dependency for some other package.

It will not tell you if YOUR code is using a package, which is what you asked for.

Best answer should therefore go to @jussimannisto

Please or to participate in this conversation.