-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
composer autoload issue #89
Comments
@itsonit see related issue #61 (comment) Will be solved when moving to php7 only in the next major. For now |
For now you need to disable this check. Because the folder is not correctly "relative" |
thx for your reply. For my purpose it was simple to switch routing from filesystem to programmatic aka url-rewrite. |
Nice you found already a workaround 👍 |
@ThaDafinser Faced with this problem right now. Can you fix this bug? |
@egorsmkv can you show me your directory structure and give more informations? |
@ThaDafinser I add your library to my Yii2 project and get this error. |
@egorsmkv you can do a |
I think this could work if (! file_exists(__DIR__ . '/../../../../' . $this->getPackageName() . '/composer.json') && ! file_exists(__DIR__ . '/../../vendor/' . $this->getPackageName() . '/composer.json')) {
throw new PackageNotLoadedException('You need to install the package ' . $this->getPackageName() . ' to use this provider');
} |
the fact is that I do not want to put the crutches in the code |
@egorsmkv i asked you for your directory structure and i asked if you could post the output of a debug statement. If you dont want to give me any information i will stop trying to solve this issue //note the comment above "I think this could work..." is a side note for a possible fix |
@ThaDafinser basic yii2 structure: https://github.com/yiisoft/yii2-app-basic#directory-structure Maybe it's worth to check availability of the library through the |
I found this solution... Need to create a PR soon. |
//cc to all forks, which corrected this issue - please try out the latest master 😄 |
@ThaDafinser When do you plan to release a new version which includes this fix? |
@chris-doehring i'm just waiting for a feedback, from 1 or 2 people... |
@ThaDafinser unfortunately, I don't use this library, so I can't test the change. |
@ThaDafinser I tried version 1.4.0 and got the same issue as described above. The current dev-master does fix the issue. |
Yes, seems to be working. Tested on symfony 2.8. |
If the running script is placed in a a subdirectory, it will break the loading of the installed providers.
For ex., including autoload like this
require __DIR__.'../vendor/autoload.php';
produce a fatal error:
PHP Fatal error: Uncaught exception 'UserAgentParser\\Exception\\PackageNotLoadedException' with message 'You need to install the package piwik/device-detector to use this provider' in ..
The text was updated successfully, but these errors were encountered: