Search code examples
phplaravelframeworksvendor

Laravel 5 - Change Models,Views,Controllers path


i have edited psr-4 on composer.json

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "Marka\\Urun\\": "vendor/Marka/Urun/src/",
        "App\\": "app/"

    },
    "files": [
        "vendor/Marka/Urun/src/helpers.php"
    ]
},

I want to change file(routes.php, helpers.php and Models,Views,Controllers) pathes to : Vendor/Marka/Urun/

enter image description here

How can I do it ?


Solution

  • You're trying to get some modular structure if I get it right.

    If so, instead of trying to set a different namespacing from composer for each of your modules under vendor directory; i think you may try to use something like http://sky.pingpong-labs.com/docs/2.0/modules

    Otherwise as you may know, by using PSR-4 and directory structure, if you coded your files properly all necessary files would be loaded automatically as you named (namespaced) them.

    By the way, just in case you didn't know you may also need a ServiceProvider to boot everything up for Laravel on your package.

    I also suggest you to read https://laravel.com/docs/5.2/packages if you need any help about development structure/functionality.