Yii Framework Forum: Modular architecture with hooks for apps - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Modular architecture with hooks for apps

#1 User is offline   dans 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 21-October 10

Posted 19 April 2016 - 09:19 PM

G'day all!

When I write web apps in Yii2 I find that I have a lot of reusable components. I always have authentication, acl's, logging, menu builders, system properties, etc. I am looking to hear what you all do to manage your code if you work the same way.

I am thinking of either doing one of the following:

1. Create a 'base application', with lots of modules (one for each app) and use hooks/events to register menu items, etc. This would result in 1 code base for all my apps.

2. Create a base application which I extend and create a copy of it for each project I work on. This would provide more flexibility but multiple code bases to manage.

When I think about it, what I want to build is no different to the modules that I download from Github. But I guess my concern is that I want to integrate the modules a lot closer into the base code (ie. I have a notification tab, and a consistent way for creating menus).

Are there any design patterns or system architectures around for how I may build this type of modular application? Would it all be driven by modules & events?



#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,225
  • Joined: 17-January 09
  • Location:Russia

Posted 20 April 2016 - 03:46 AM

I'm extracting these into OpenSource components where possible such as https://github.com/samdark/sitemap or https://github.com/s...ed-menu-widget. When extracted well, it's easy to reuse these. If most of the projects you're working on are similar, I suggest creating your own application templates (it's described in the guide).
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I can work more on Yii: https://www.patreon.com/samdark

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users