Tinkerwell 4 is out now! See what's new or buy now.
Tinkerwell background image
Tinkerwell Logo Tinkerwell
Go back to Blog

Enabling autocompletion for unrecognized classes

Tinkerwell supports fantastic autocompletion for many classes out of the box and if you use it on Laravel helpers or initialize classes directly, there is no need for additional steps to make it work.

But sometimes Tinkerwell can't detect which class you are using in your code and does not provide the autocompletion experience that you love. In this case, it makes sense to manually add a type-hinting comment to that line and enable autocompletion.

So if you use Tinkerwell with Laravel and simply load a user from the database via Eloquent, autocompletion might not work directly.

That's a common problem with most IDEs and the magic of the framework – but luckily, you can enable autocompletion via a type hinting comment. Simply add the reference to the class as a comment and autocompletion works again.

That's not only helpful when working with Eloquent models but also in scenarios where return types of methods aren't that clear and you can't remember all methods but also don't want to open the class in your IDE to look them up. So adding a type hint solves a common problem when tinkering with your code on production environments where you can't easily open the files to see which methods are available on an object.

Jack Ellis, Co-founder of Fathom Analytics
“I use Tinkerwell every single day and have 25 tabs open at any one time. It’s the essential tool for Laravel developers”

Jack Ellis

Co-founder of Fathom Analytics

Mark Pruitt, Sr. Engineer Web Services
“I love being able to save code as snippets or files for reuse. Having multiple tabs allows me to do what I can't in a single tinker session. Remote ssh allows me to use it on stage and production servers as well, instead of tinker.”

Mark Pruitt

Sr. Engineer Web Services

Tinkerwell: The PHP Scratchpad

The must-have companion to your favorite IDE. Quickly iterate on PHP code within the context of your web application.

Buy now Learn more