zfcampus / zf-content-negotiation

BSD 3-Clause "New" or "Revised" License
18 stars 32 forks source link

Zend\Console\Console and Zend\Console\Request not found #80

Open michsk opened 8 years ago

michsk commented 8 years ago

In ZF\ContentNegotiation\Factory\RequestFactory we have a dependency on Zend\Console\Console and Zend\Console\Request but those are not defined in the composer.json. Now when i call composer install --no-dev --o i get the error ( ! ) Fatal error: Uncaught Error: Class 'Zend\Console\Console' not found in /srv/www/kp-webservice/vendor/zfcampus/zf-content-negotiation/src/Factory/RequestFactory.php on line 22

ghost commented 8 years ago

zend-console is only required for calling Zend\Console\Console::isConsole() which does nothing more than PHP_SAPI === 'cli'.

In my opinion zend-console should be suggested dependency only required for using console routes. This means the check if it's a command line environment should be done without zend-console.

alexz707 commented 7 years ago

+1 This is definitley a bug! In my opinion there should be a travis build with --no-dev --o and one of the following steps:

Are there any opinions from the maintainers? ping @weierophinney

Best regards alex

mabez commented 6 years ago

+1

The same was the case with me. I agree with the @alexz707.

In my case it occurred while trying to deploying the apigility in heroku. Heroku does not allow deploy in dev mode. But the error occurs in production mode.

michalbundyra commented 6 years ago

From composer.json:

    "suggest": {
        "zendframework/zend-console": "^2.3, if you intend to use the RequestFactory"
    },

https://github.com/zfcampus/zf-content-negotiation/blob/master/composer.json#L47

And:

$ composer install --no-dev -o
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating optimized autoload files

All seems to be fine.

If you'd like to use RequestFactory you must define zend-console dependency explicitly in your composer.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas-api-tools/api-tools-content-negotiation; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-content-negotiation/issues/6.