I am using slim framework 2 with medoo via composer, i am making singleton
for medoo but when i call the medoo class to configure my db info, so it gives me the fatal error
like below
Fatal error: Class 'medoo' not found in C:\xampp\htdocs\school\s.php on line 5
below is my s.php
file
<?php
require 'vendor/autoload.php';
$app = new\Slim\Slim();
$app->container->singleton('test',function () use ($app) {
return new medoo([
'database_type' =>'mysql',
'database_name' =>'mydb',
'server'=> 'localhost',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'option' => [
PDO::ATTR_CASE=>PDO::CASE_NATURAL
]
]);
});
$app->get('/', function () use($app) {
echo "<center><b><a href='#' target='_blank' >WELCOME TO TESTING PAGE</a></b></center>";
$sth = $app->test->insert("t", ["id" =>1, "name" => "dsfdsf"]);
var_dump($sth);
});
$app->run();
?>
If i check the composer.json
file then i find slim and medoo both are there, i am not getting why this fatal error
is coming please help me
Two things:
That is:
For reference, see: