tuupola/slim-basic-auth

Class NOT found

Closed this issue · 3 comments

I have installed composer require tuupola/slim-basic-auth
but it saying

Using version ^2.3 for tuupola/slim-basic-auth
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files

and POSTMAN is giving error like "Class 'Tuupola\Middleware\HttpBasicAuthentication' not found C:\xampp\htdocs\MySlimAPI\public\index.php"

I alien to this framework, I read documentation but unable to find out the solution. please kindly guide me.

You said you have installed version 2.3. Follow the documentation for 2.x branch. For example:

$app = new \Slim\App;

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

See the difference of namespace. Old version uses Slim\Middleware, new version uses Tuupola\Middleware.