How to integration Psysh in Slim Project? [ SOLVED ]


#1

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?


#2

You could use PhpStorm with XDebug. Works great :slight_smile:


#3

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.


#4

XDebug also works well with Visual Studio code (+PHP Debug).

https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug

What’s the error message?


#5

@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.


#6

Thanks everyone i have solved my problem. I create tinker for slim application integrate with symfony process. If you want to see my work please support and give me your opinion.

Harmony Betta Framework Built Under Slim 3