tuupola / slim-basic-auth

PSR-7 and PSR-15 HTTP Basic Authentication Middleware
MIT License
440 stars 66 forks source link

Class NOT found #80

Closed ash24ish closed 5 years ago

ash24ish commented 5 years ago

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"

tuupola commented 5 years ago

See documentation for 2.x branch.

ash24ish commented 5 years ago

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

tuupola commented 5 years ago

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.