Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument 1 passed to Slim\Slim::add() must be an instance of Slim\Middleware #75

Closed
ghost opened this issue Aug 30, 2018 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Aug 30, 2018

\Slim\Slim::registerAutoloader();

$app = new \Slim\Slim(array(
    'debug' => true
));

$app->add(new \Slim\Middleware\HttpBasicAuthentication([
     "secure" => false,
     "users" => [
         "root" => "root",
     ]
]));

Catchable fatal error: Argument 1 passed to Slim\Slim::add() must be an instance of Slim\Middleware, instance of Slim\Middleware\HttpBasicAuthentication given, called in /home/c19193/public_html/index.php on line 18 and defined in /home/c19193/public_html/lib/Slim/Slim.php on line 1267

What is wrong with my configuration?

Slim 2, Slim\Middleware\HttpBasicAuthentication for Slim 2

@tuupola
Copy link
Owner

tuupola commented Dec 14, 2018

Slim 2 is only supported by 1.x branch. 2.x and 3.x branches are for Slim 3.

$ composer require tuupola/slim-basic-auth:^1.0

@tuupola tuupola closed this as completed Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant