php - Multiple Laravel 5 and AngularJS Apps -


i'm working on project has multiple loosely coupled modules (20+) , have decided go laravel 5 , angularjs. i'm using yeoman angularify generator angularjs. can't decide on application structure, ideally want each sub-module different app easy developers work on separate apps independently.

mylab/     app/         http/             controllers/                 somecontroller.php # api's used across apps         ...     public/         bower_components/             angular/             bootstrap/         scripts/             angular.modules.js #custom modules used across apps             ..     resources/         views/             .. #landing page view      sub-app1/         app/             http/                 controllers/                     subapp1controller   #sub-app1 specific api's             ..         public/             bower_components/                 repo1/ #specific sub-app1             ...         resources/             angularapp1 #spa sub-app1             views/      sub-app2/         app/             ... 

and routing, :

http://mylabs                                   //login or landing page http://mylabs/subapp/route1/123someid 

what best way achieve in laravel ?

is structure enough, scalable, manageable ?

if not there better way achieve ?

for laravel routing can use this:

route::group(['prefix' => 'subapp1'], function() {     route::get('route1/{id}', 'subapp1controller@show'); }); 

your solution pain manage down road. it's creating complexity , duplication without buying in terms of functionality. make sure have reason doing other being easy developers work on independently, because can still have following approach.

i'd suggest using single laravel application handle of routes separate controller (or controllers) each sub app. easier maintain , still lets developers stay in own files don't conflict 1 another. exception routes.php, can define routes front developers aren't editing it.

i prefer keep angular separate laravel putting angular code in public folder, depends on how you're planning blade vs. angular. it's hard without knowing more apps, leave majority of work in angular , laravel send down initial page.

this avoids blade vs. angular expression conflicts , keeps angular application decoupled laravel. if choose keep angular in laravel views, make sure handle somehow. few common solutions change delimiters {{ }} or prefix angular expressions @ symbol so: @{{ user.email }} prevent blade parsing them.

here's how lay out directory structure:

app/     http/         controllers/             appbasecontroller.php # api's used across apps             subapp1controller.php # sub-app1 specific api's             subapp2controller.php # sub-app2 specific api's     ... public/     bower_components/         angular/         bootstrap/     scripts/         angular.modules.js # custom modules used across apps         angularapp1/ # spa sub-app1         angularapp2/ # spa sub-app2         ... resources/     views/         ... # landing page view         sub-app1/             ... # sub-app1 views         sub-app2/             ... # sub-app2 views 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -