I bet you didn’t know it but Nette’s internal behaviour can be configured quite extensively in config.neon. Default form error messages, switching on/off debugger panels, changing mailer to use SMTP instead of mail() and so on. All of this can be set up in PHP but keeping configuration out of your code helps making it easier to read. Do have a look, it has a great potential. As usually, the documentation is pretty bare and it’s up to us to discover the whole truth. This post contains some additional information that I scavenged in forums or discovered myself.
Assign user a session namespace (session is the default storage):
-
services:
-
nette.userStorage:
-
setup:
-
– setNamespace("myName")
Install custom macros using a factory:
Use your own database debugger panel:
Switch mailer to SMTP/localhost in order to catch all e-mails with MailSnag:
Post a comment if you know more goodies.
Tags: Nette Framework 2.0.8 (revision b7f6732 released on 2013-01-01)
Hi, just to be clear, I’ve removed that part with user namespace from doc, because it’s for configuration options, not for services “hacking”. If you’re interested, you may send a pullrequest (I will do it eventually, but not in near future), so we could write this
There is already syntax for macros, that is not yet in stable, so it’s not in documentation http://doc.nette.org/cs/configuring/nette-framework?rev=12#toc-sablony
Thanks for the explanation and heads up on the macros syntax.
To me, there’s no difference between “hacking” and proper configuration in Nette. It’s all magic, pieces of code that I see someone using in the forum. The line that you draw between “good” and “bad” is artificial, in my opinion. I bet that in a few months time you yourself will consider today’s good practices outdated and inappropriate.