Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Class Map Generator removed #12

Open
rcapile opened this issue Jan 11, 2017 · 10 comments
Open

Class Map Generator removed #12

rcapile opened this issue Jan 11, 2017 · 10 comments

Comments

@rcapile
Copy link

rcapile commented Jan 11, 2017

You mention the Class Map Generator (bin/classmap_generator.php) on the docs but removed it when zend-loader got separated from zf2. Did you miss the file ou should I remove from docs?

@pensiero
Copy link

pensiero commented Feb 17, 2017

+1 I used the classmap_generator.php of zendframework/zendframework package (https://github.com/zendframework/zendframework/blob/release-2.5.3/bin/classmap_generator.php) but actually i'm including each package as separate package, so I do not have those files anymore.

How can I recover a classmap_generator.php file?

@pensiero
Copy link

Meanwhile I published this: https://github.com/pensiero/zend-generators

@Ocramius
Copy link
Member

A classmap generator shouldn't be needed at all if you just rely on composer's...

@pensiero
Copy link

pensiero commented Feb 17, 2017

Actually in my Module.php the getAutoloaderConfig() method use it:

public function getAutoloaderConfig()
    {
        if (getenv('ENV') == 'development') {
            return [
                'Zend\Loader\StandardAutoloader' => [
                    'namespaces' => [
                        __NAMESPACE__ => __DIR__ . '/../src/' . __NAMESPACE__,
                    ],
                ],
            ];
        } else {
            return [
                'Zend\Loader\ClassMapAutoloader' => [
                    __DIR__ . '/../config/autogenerated/autoload_classmap.config.php',
                ],
            ];
        }
    }

should I replace it with something else?

@pensiero
Copy link

pensiero commented Feb 17, 2017

PS: autoload_classmap.config.php is the file generated by the classmap_generator.php script

@Ocramius
Copy link
Member

@pensiero just move all that stuff in your composer.json "autoload" section, sit back and relax :-)

@pensiero
Copy link

Am I good this way?

  "autoload": {
    "psr-4": {
      "Uala\\": "module/Uala/src/",
    }
  },

@Ocramius
Copy link
Member

Correct. No more need for pesky manual classmaps.

@arueckauer
Copy link

I wanted to provide a PR, updating the documentation. However, ClassMapAutoloader documentation suggests the usage of classmap_generator.php.

Is there a valid use case for ClassMapAutoloader, without the generator? How would a classmap be generated, if the generator is gone? Is it compatible with a classmap generated by Composer? But then why would one not use Composer?

It seems that ClassMapAutoloader can be removed as well. @Ocramius / @froschdesign can you confirm that?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-loader; a new issue has been opened at laminas/laminas-loader#1.

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

No branches or pull requests

6 participants