Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Dominik Sigmund
    @DSigmund
    Hi, i've got an error with harmony using the basic Example given...
    I am using xampp on windows and have harmony in a subfolder
    there i have this code:

    `<?php
    declare(strict_types=1);

    require_once 'vendor/autoload.php';

    use Psr\Http\Message\ResponseInterface;
    use Psr\Http\Message\ServerRequestInterface;
    use FeG\FFB\Predigten\Controller;
    use WoohooLabs\Harmony\Harmony;
    use WoohooLabs\Harmony\Middleware\DiactorosResponderMiddleware;
    use WoohooLabs\Harmony\Middleware\DispatcherMiddleware;
    use WoohooLabs\Harmony\Middleware\FastRouteMiddleware;
    use Zend\Diactoros\Response;
    use Zend\Diactoros\Response\SapiEmitter;
    use Zend\Diactoros\ServerRequestFactory;

    // Initializing the request and the response objects
    $request = ServerRequestFactory::fromGlobals();
    $response = new Response();

    // Initializing the router
    $router = FastRoute\simpleDispatcher(function (FastRoute\RouteCollector $r) {
    $r->addRoute("GET", "/predigten/{slug}", [PredigtController::class, "getPredigt"]);
    $r->addRoute("GET", "/predigten/", [PredigtController::class, "getPredigten"]);
    });
    // Stacking up middleware
    $harmony = new Harmony(ServerRequestFactory::fromGlobals(), new Response());
    $harmony
    ->addMiddleware(new DiactorosResponderMiddleware(new SapiEmitter()))
    ->addMiddleware(new FastRouteMiddleware($router))
    ->addMiddleware(new DispatcherMiddleware());
    // Run!
    $harmony();
    ?>`

    The filename is api.php, the folder is "predigten"
    so i am trying to call: http://127.0.0.1/predigten/api.php
    and get the following error:
    Fatal error: Uncaught WoohooLabs\Harmony\Container\BasicContainerNotFoundException in C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Container\BasicContainer.php:26 Stack trace: #0 C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Middleware\DispatcherMiddleware.php(48): WoohooLabs\Harmony\Container\BasicContainer->get('PredigtControll...') #1 C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Harmony.php(150): WoohooLabs\Harmony\Middleware\DispatcherMiddleware->invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(WoohooLabs\Harmony\Harmony)) #2 C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Harmony.php(61): WoohooLabs\Harmony\Harmony->executeMiddleware(Array) #3 C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Middleware\FastRouteMiddleware.php(54): WoohooLabs\Harmony\Harmony->invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response)) #4 C:\Users\sigmu\Code\fegffb_predigten\ven in C:\Users\sigmu\Code\fegffb_predigten\vendor\woohoolabs\harmony\src\Container\BasicContainer.php on line 26
    Dominik Sigmund
    @DSigmund
    Any help would be great :-)
    Dominik Sigmund
    @DSigmund
    Hi, just checked, it ist an autoload error...
    sorry for bothering
    Máté Kocsis
    @kocsismate
    Hey! I'll think about the problem and write you soon!
    Dominik Sigmund
    @DSigmund
    Thanks, but i solved it with correct autoload-Settings ;-)
    Máté Kocsis
    @kocsismate
    Ah cool :)