I use Slim 3 and other modules like eloquent model, database, etc. I tried to integrate with Psysh to interact with my Slim Application. But does’t work. So what can i do?
You could use PhpStorm with XDebug. Works great
but i use vscode to develop slim applications. I tried to install psysh but when trying to access Eloquent Model I get error or indeed tinker only for Laravel.
XDebug also works well with Visual Studio code (+PHP Debug).
What’s the error message?
@betta_ratna I use Slim with Psysh and Eloquent, it works well for me. I’ve created a
psysh.php file that looks something like this.
<?php require __DIR__ . '/vendor/autoload.php'; date_default_timezone_set('UTC'); $app = new App\App(); $capsule = $app->getContainer()->get('capsule'); $capsule->setAsGlobal(); $capsule->bootEloquent(); echo "Welcome to Slim Psysh!\n";
You might need to do something a little different, particularly with the App\App, you might need something like
$app = new \Slim\App();
I’ve got Psysh installed globally, so I run
$ psysh psysh.php from the terminal and can then access all of my Eloquent models.