gitwithravish's avatar

What are the alternatives of Tinkerwell?

Are there any cheaper or free options available that does the job like Tinkerwell?

https://tinkerwell.app

0 likes
18 replies
Foks's avatar

It depends on which of the functionality that you want. If you're looking for a 'copy' of Tinkerwell, I don't think there are any other alternatives without giving up some of the functionalities.

gitwithravish's avatar

I want some interface in which i can run code snippets and see quick results. For example, if I want to quickly check laravel collection methods or implement some small logic and see the outcome. It would be good to have an interface like tinkerwell to quickly experiment php/laravel code.

nategg's avatar

Can anyone point me to instructions for using Tinkerwell? Just bought it yesterday and it does weird crap like adding dozens of identical rows to my tables (just by moving my cursor around the commands? IDK); gets stuck on errors many commands above, doesn't allow me to retype and retry, no way to get past the error; no apparent way to step up thru previous commands like up-arrow in real Tinker; don't know how to clear screen. Cannot find any real instructions at their site. Their "tutorials" are junk. Thanks

nategg's avatar

Well, they issued me an immediate refund. Didn't even try to fix/explain the issues I raised. ?? Very disappointed. Seemed like a super good idea.

Snapey's avatar

@nategg

It works well. Your experience is unusual.

I don't see how it could insert rows into your database unless you had code in tinkerwell to do this?

lazerg's avatar

@SlimDeluxe

  • Create vendor/_tinker folder
  • Put index.php and Tinker.php file there.
  • Run php -S localhost:3030 -t "vendor/_tinker" in root project folder.

vendor/_tinker/index.php :

<?php

define('LARAVEL_START', microtime(true));

// Composer autoload
require __DIR__ . '/../autoload.php';

// Bootstrap Laravel
$app    = require_once __DIR__ . '/../../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

// Handle the request
$kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

// Tinker
$tinker_start = microtime(true);
require 'Tinker.php';
Tinker::tinker();

$tinker_end       = microtime(true);
$duration         = round(($tinker_end - $tinker_start) * 1000, 2);
$duration_laravel = round(($tinker_end - LARAVEL_START) * 1000, 2);

// Prepare the response
$date     = now()->toDateTimeString();
$message  = "Tinker ran at {$date} in {$duration}ms ({$duration_laravel}ms in total)";
$response = response('<hr><code>' . $message . '</code>');
$response->send();

// Terminate the application
$kernel->terminate($request, $response);

vendor/_tinker/Tinker.php :

<?php

class Tinker
{
    public static function tinker(): void
    {
        dump('Hello World');

        collect([
            'dog',
            'cat',
            'bird',
            'fish',
        ])
            ->map(fn($animal) => ucfirst($animal))
            ->dump();
    }
}

Now you can edit from Tinker class and then go to localhost:3030 to check/run

3 likes
faizan101010's avatar

In case anyone is still wondering about this, there is a free PHPStorm plugin called Laravel Tinker. It works great and does most of the things you need.

3 likes

Please or to participate in this conversation.