The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.


uwe.d.wagner's Avatar


08 Jul, 2012 01:47 PM

I try to play with Basic Auth and copy the HttpBasicAuth.php file into the Slim/middleware folder.

$app->add(new Slim_Middleware_HttpBasicAuth('account', 'password'));

doesn' t find the Class HttpBasicAuth. Must the class to be registered anywhere else. Explicit

require '...'

works fine.

version: Slim 1.6.4, Win7

  1. Support Staff 1 Posted by Andrew Smith on 10 Jul, 2012 08:19 AM

    Andrew Smith's Avatar

    Hi, we suggest not to add extras inside your Slim Core as this will become problematic when if you decide to update to a newer version of Slim, currently you need to explicitly require the middleware, however on the release-1.0.3 branch of the Slim-Extras repo, we are testing out using Composer autoload class to load the extas in.

  2. Support Staff 2 Posted by Brian Nesbitt on 10 Jul, 2012 02:13 PM

    Brian Nesbitt's Avatar

    Ya, if you keep it simple and use composer you can get up and running very quickly.

    mkdir slimtest
    cd slimtest
    curl -s | php

    Create a composer.json like:

        "require": {
            "slim/slim": "1.6.*",
            "slim/extras": "dev-release-1.0.3"

    Then run:

    php composer.phar install

    Then use an index.php like:

    require 'vendor/autoload.php';
    $app = new Slim();
    $app->add(new Middleware_Auth_HttpBasic('us', 'pa'));
    $app->get("/", function () {
        echo 'index!!';

    You can get win32 ports of curl here

  3. 3 Posted by uwe.d.wagner on 11 Jul, 2012 08:44 PM

    uwe.d.wagner's Avatar

    Thanks for your quick response. Must first update my local php version. Composer supports only php > 5.3.2.

    The linux server runs with php version 5.2.* (what i can't change - > university), where i have very limited access.

  4. uwe.d.wagner closed this discussion on 11 Jul, 2012 08:44 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac