Mark Dain Finally got round to learning slimframework.com, it's really nice, I like it
Martijn I am using that for my latest project as well. Took a bit to get my head around Middleware but I like it.
7y, 35w 3 replies
Mark Dain Yeah, middleware rocks. I wrote a handler for the Authorization HTTP header which is surprisingly quite long (almost 100 lines). It's so nice every endpoint that needs protecting can do so via a group. How awesome is that! I also like the container system, so my DB connection is something like $this->get('db') rather than pulling something in via global.
7y, 35w 2 replies
Login or register your account to reply
Martijn Also cool because it will (theoretically) let you swap out your DB library without requiring you to change anything else. Just assign the new thing as 'db' in your container. Now I just wish there was a nice way to bring sessions into this.
7y, 35w 1 reply
Mark Dain I'm not an expert but I think you need adapter classes for that. For me, 'db' returns an instance of MySQLi, so I'd need to shim that or switch to PDO? I didn't do anything wit sessions but I found you can pass data back via an attribute so after I parse the Authorization header, I set a user ID so the controller can use that value; slimframework.com/... (scroll to bottom "Passing variables"). A quick search I found this github.com/akrabat... which seems idiomatic?
7y, 35w reply