-
Notifications
You must be signed in to change notification settings - Fork 23
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
Troubles namespacing nesbot/carbon #70
Comments
Looks like it doesn't use autoloading for all its classes:
Strauss determines which files to copy and prefix by reading the packages' composer.json autoload keys. So since Carbon has omitted those files, Strauss doesn't pick them up. Strauss has an Using this as your
There is an issue with double-prefixing when using |
Thanks @BrianHenryIE this resolved the issue! I understand that the double-prefixing issue is not present when we use strauss as a dependency. Is there a way to use strauss a a dependency without the issues I experienced with the composer requirement as mentioned in: If there is a sollution for that then I could prevent deleting the prefixed If not then I will delete the By the way; using the |
When running the
strauss.phar
command aftercomposer install
all my dependencies get prefixed correctly exceptnesbot/carbon
.In short:
All classes in the
vendor/nesbot/carbon/src
directory get prefixed correctly. But the classes in the rootvendor/nesbot/carbon
directory doesnt and the classes insidevendor/nesbot/carbon/lazy
does not get prefixed either.My
composer.json
:As you can see I am running a custom shell script after the regular composer commands like install and update. The shell script is looking like this:
So everything works fine after running the script. The plugin gets loaded correctly and thus I thought everything worked fine :) Except I encountered the following error on a specifc page where I use the
Carbon
class. This fatal error is showing:Upon investigation I found that not all classes from
vendor/nesbot/carbon
are getting prefixed. All classes in thevendor/nesbot/carbon/src
directory get prefixed correctly. But the classes in the rootvendor/nesbot/carbon
directory doesnt and the classes insidevendor/nesbot/carbon/lazy
does not get prefixed either. The error is originated from thelazy
directory.Its not a very big directory so I tried prefixing them manually and running
composer dump-autoload
afterwards. This fixes the issue.I am wondering if this is a bug or due to misconfiguration on my end.
Thanks again for this project!
The text was updated successfully, but these errors were encountered: