I'm about to start a new project and I've decided to go with sf4.
So first I've created a new sf project composer create-project symfony/skeleton
But this time I want to get rid of the default App namespace and change it to a specific, project related namespace. But I'm not really sure how to do this. I've tried to edit the psr autoload in the composer.json and run composer dump-autoload
but I'm getting this error
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "Kernel" from namespace "App".
I hope someone can help me.
Greets
Assuming this is for a C# project and assuming that you want to change the default namespace, you need to go to Project Properties, Application tab, and specify "Default Namespace". Default namespace is the namespace that Visual studio sets when you create a new class.
Place your cursor in the namespace name. Press Ctrl+. to trigger the Quick Actions and Refactorings menu. Select Change namespace to <folder name>.
You can change the default namespace, and the assembly name, independently of the name of the project using the project's property pages. If you are using Visual Studio 2003, right-click the project's name in the Solution Explorer and choose "Properties" from the context-sensitive menu that appears.
When working with a framework, you have to learn to go with it's conventions and not against it. Messing with the core files is a terrible idea as it will make upgrades really complicated. Also, frameworks are there to facilitate team work on a project, if you start of by making your own naming conventions you are breaking this.
If you need to have reusable components across multiple projects, Symfony handles that already: https://symfony.com/doc/current/bundles/best_practices.html
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