Craft 3 - Can't access the craft() in plugin controller
craft() is gone in Craft 3; instead you will be accessing Craft::$app-&gt; for most things. I'd suggest generating your Craft 3 plugin scaffolding at pluginfactory.io, and if you leave code comments on, it'll give you some hints on how to do stuff like this.

This article might also be helpful to you: So You Wanna Make a Craft 3 Plugin?