Jump to content

Should composer classes ever be used in an application? And if so, how?


Go to solution Solved by kicken,

Recommended Posts

This is probably a stupid question.

I wish to get a collection of classes which exist in a given directory, and found this post which directed me to this class, but it is depreciated and appears that this class should now be used.

Great, I have Composer, and all I need to do is call Composer\Autoload\ClassMapGenerator::createMap($pathToDirectory)!

Or do I?  The only files included in vendor/composer are below.

  • autoload_classmap.php
  • autoload_files.php
  • autoload_namespaces.php
  • autoload_psr4.php
  • autoload_real.php
  • autoload_static.php
  • ClassLoader.php
  • installed.json
  • installed.php
  • InstalledVersions.php
  • LICENSE
  • platform_check.php

I expect this is due to how I installed composer globally.

Should composer classes ever be used in an application other than for dependency management?  Or should I just create my own class for this need?

image.png

  • Solution

You can use composer stuff, you'd just need to add the "composer/composer" package as a requirement to your project.

If all you need is the class map stuff, that is it's own component (composer/class-map-generator) so you could include just it instead.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.