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
"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 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:
Why are we doing this way:
- We want to use the same domain.
- We want to use the same composer.json
- 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?