since about 1 year i’m coding on a RESTful api with Slim 3. until now i finished about 145 routes, and i’m
looking forward to get all 322 routes done (within the next year(s)). more to come…
my controllers are all setup with injection of the whole $container.
each controller initiates the needed classes with injection of only the needed objects/settings/data.
until now i used logging only for access, error and output logging within middleware, but i’m missing the logger in all my classes.
now i like to implement the logger, for debugging purposes, to the upcoming live-system (i.e.: for monitoring of database and soap requests)
i think there are 3 ways to do:
- update all __constructs to include the logger object (much work)
- add middleware to PDO and SOAP (not nice, and not flexible)
- somehow use a $Global object for the logger?
is there some solution like i mention at no3? should i avoid going this way?
i’d prefer to access all callables from dependencies.php, and the data of settings.php, in all classes.
i’ve never done OOP before i started with slim3.
so i might miss something, and my thoughts might be wrong?
(i did read the PSR, MVC and RESTful conventions. and i’m trying to follow them)
your help will be apprecated!