the question is when I use symfony 2.7,I upload my own bundle onto composer packagist. First I try my composer.json like that
{
"name" : "funmi/sms-bundle",
"description" : "a develop components from funmitech",
"type" : "symfony-bundle",
"authors" : [{
"name" : "funmi",
"email" : "[email protected]"
}],
"keywords" : [
"funmi develop"
],
"license" : [
"MIT"
],
"require" : {
},
"autoload" : {
"psr-0" : {
"Funmi\\SmsBundle" : ""
}
},
"target-dir" : "",
"repositories" : [{
}],
"extra" : {
"branch-alias" : {
"dev-master" : "1.0-dev"
}
}
}
But when I new Funmi\SmsBundle\FunmiSmsBunle() in appkernel.php it says
namespace not exist
,than I change the target-dir's value to / or src/ but it still not work.
It only work when I set target-dir value to Funmi\SmsBundle,now the problem is why i must set like that?
target-dir is deprecated, do not use it.
I expect that your bundle class lives in the root directory, correct? That means you need to configure the PSR-4 autoloader:
"autoload" : {
"psr-4" : {
"Funmi\\SmsBundle\\" : ""
}
},
This configures the autoloader to search for Funmi\SmsBundle\FunmiSmsBundle in /FunmiSmsBundle.php.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With