0

I have a Zend application, with composer.json I installed laravel/framework using the following command:

docker-compose exec web-server composer require laravel/framework:8.*

I am creating a folder inside the zend application naming it spirit

enter image description here

"autoload": {
        "psr-4": {
            "App\\": "spirit/app/"
        }
    },
"require": {
    "php": "^7.4",
    "laravel/framework": "8.*"
}

The requirement is to redirect users to this laravel application for a few URL:

https://example.com :: loads zend application

https://example.com/auth :: loads laravel application inside the zend.

For the public/index.php of zend application, I check if the URL is for auth, I load the laravel application, loading its bootstrap/app.php

if (stripos($_SERVER['REQUEST_URI'], 'auth') !== FALSE) {

    $app = require_once __DIR__.'/../spirit/bootstrap/app.php';

    $kernel = $app->make(Kernel::class);

    $response = $kernel->handle(
        $request = Request::capture()
    )->send();

    $kernel->terminate($request, $response);
    exit();
}

I get following error:: enter image description here

I made changes adding :: require __DIR__.'/../vendor/autoload.php';

if (stripos($_SERVER['REQUEST_URI'], 'auth') !== FALSE) {

    require __DIR__.'/../vendor/autoload.php';

    $app = require_once __DIR__.'/../spirit/bootstrap/app.php';

    $kernel = $app->make(Kernel::class);

    $response = $kernel->handle(
        $request = Request::capture()
    )->send();

    $kernel->terminate($request, $response);
    exit();
}

Now I get the following error:

enter image description here

Why are we doing this way:

  1. We want to use the same domain.
  2. We want to use the same composer.json
  3. We have Git Lab Ci-CD pipelines, so we want to use the same git flow and ci-cd pipeline, and have test coverage, code coverage, packages security checks, and everything configured in one place.

What is it that is not correct?

Is there any reference I can use to create my own laravel bundle using the laravel framework?

Vivek Tankaria
  • 1,301
  • 2
  • 15
  • 35
  • Try this https://stackoverflow.com/questions/38918982/laravel-error-reflectionexception-class-app-http-kernel-does-not-exist#answer-38920903 – StewieSWS Feb 23 '23 at 16:35

0 Answers0