• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Store Notification Messages

#1
Hi,

Not sure if this is the best place to post this, but here goes.

I'd like to keep all of my applications notification messages in one spot for easier maintenance. Right now I've created a library Messages and store all of the messages as constants, so then I can refer to them as Message::ERROR_WITH_SUBMISSION in the code, for example.Is this an accepted way?

Or should I be adding these types of messages be added to the constants.php file?

How would you go about this?

Thank you in advance,
Chris
Reply

#2
IMO, the library is a better solution than using constants.php mostly because the library provides a clear separation of concerns. Even with the library I would probably use a separate file that contains the actual constant definitions.

An alternative approach might be to use a config file where the messages are accessed by using keys into the config array.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.