Support the ongoing development of Laravel.io →
Configuration Packages Architecture
Last updated 1 year ago.
0

You Only have the extra vendor Dir when using the workbench. When they are actual packages, you only have the main vendor Dir.

Last updated 1 year ago.
0

barryvdh said:

You Only have the extra vendor Dir when using the workbench. When they are actual packages, you only have the main vendor Dir.

Interesting. So you say I can just create "packages" without the workbench in a specific directory structure and create routes for it? Architecturally speaking I want to split my application parts in seperate directories with their own controllers and views. I would like to separate models in again another directory, because they are application wide.

Last updated 1 year ago.
0

Solved it for now by creating my own directory structure in the directory ./modules and using this in composer.json:

"psr-0": {
    "Articles": "modules/"
}

inside the "autoload": { part. So my structure is as following:

mylaravelproject
    - modules
        - Articles
        - *othermodules

The PSR-0 autoloader looks for classes inside ./modules/Articles. The namespace to use in the Articles directory is:

namespace Articles;
Last updated 1 year ago.
0

Yes and you can also register extra view namespaces for different directories, for your blade templates.

Last updated 1 year ago.
0

Also not bad to mention is that when you need to extend the controller you need the \ (backslash).

class MyNiceClass extends \BaseController 
{    
    public function test() 
    {
        echo \Input::get('name');
    }
}

Pay attention to the \ before Input.

Last updated 1 year ago.
0

Yes, but that's only need when you are in a namespace. Classes with a \ are absolute, others are relative. But you can also add use BaseController on top of your class, then you don't need the \

Last updated 1 year ago.
0

Thanks for the tip :)

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Faiawuks faiawuks Joined 23 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.