brefphp / laravel-bridge

Package to use Laravel on AWS Lambda with Bref
https://bref.sh/docs/frameworks/laravel.html
MIT License
314 stars 63 forks source link

Take an optional $path parameter when bootstrapping Octane #124

Closed deleugpn closed 1 year ago

deleugpn commented 1 year ago

The hardcoded option getcwd() will always resolve to /var/task/ and will require that the Laravel installation must be done at the root of the project. Variables like BREF_AUTOLOAD_PATH always allowed us to deviate from the default since we could point Bref to the proper position of the autoloader.

This PR opens up an optional parameter at the constructor of the OctaneHandler so that we can write our own file-based Bref Handler as follows:

<?php declare(strict_types=1);

use Bref\LaravelBridge\Http\OctaneHandler;

return new OctaneHandler(__DIR__ .'/../../../my/path/to/laravel/root/folder');

Having this as the Entrypoint of Lambda allows us to reuse all of the code present in this package while still being able to customize Laravel.

georgeboot commented 1 year ago

What is the purpose of this change?

deleugpn commented 1 year ago

hey @georgeboot I was still editing the primary comment 😅. Could you double-check now to see if I managed to explain it?