100% serverless Laravel Framework
Firevel is a modified, serverless version of Laravel 11 designed to work inside Google App Engine PHP 8.4 standard environment, together with Google Firestore as database and cache.
In addition to standard Laravel Framework benefits it offers:
gcloud
is initialized using gcloud init
command.gcloud config set project PROJECT_ID
.Create a project in the Google Cloud Platform Console
Install and initialize (gcloud init
) gcloud command-line tool
Create firevel project with composer create-project firevel/firevel
Generate your app.yaml
file using php artisan firevel:generate app.yaml
Deploy project with gcloud beta app deploy
Firevel does not require any credentials while running inside App Engine. If you like to run it locally you will also need to set GOOGLE_CLOUD_PROJECT
and GOOGLE_APPLICATION_CREDENTIALS
.env variables. You might also need to enable App Engine Admin API.
To replicate the production environment for local development, you can utilize Buildpacks. Use the pack command with specific environment variables:
pack build your_image_name --env=GOOGLE_COMPOSER_ARGS=--dev --builder=gcr.io/buildpacks/builder:v1
Once the image is built, it can be integrated with Docker, typically through a docker-compose.yaml
file.
You can configure PHP extensions for development mode using the php.local.ini
file. This allows for customized behavior during local development.
To execute PHP commands within the container, use the /cnb/lifecycle/launcher
. For instance:
/cnb/lifecycle/launcher php route:list
For those looking to utilize Composer within the container, it comes pre-installed. Access it with:
/cnb/lifecycle/launcher php vendor/bin/composer
To run Laravel Tinker, execute the following command:
/cnb/lifecycle/launcher php artisan tinker
For MacBook users, ensure the TERM
variable is set correctly. As an example:
docker exec -e TERM=$TERM -it your_container_name /cnb/lifecycle/launcher php artisan tinker
Firevel is a Laravel 11 after small updates and packages installation:
You can use Firevel in the same way you use Laravel. Be aware of Firebase limits and Google App Engine limits.
By default Firevel running inside App Engine is using Google Cloud Storage file system, and {GOOGLE_CLOUD_PROJECT}.appspot.com/services/{GAE_SERVICE}/storage/
path.
If you are using app.yaml
generated by firevel:generate app
your logs going to be stored in Stackdriver.
To run artisan commands inside serverless containers, install https://github.com/firevel/artisan.
If you are going to use serverless workers, install https://github.com/firevel/cloud-tasks-queue-driver.