{"id":21283743,"url":"https://github.com/affordablemobiles/gserverlesssupportlaravel","last_synced_at":"2026-05-20T11:02:40.922Z","repository":{"id":20518401,"uuid":"90136781","full_name":"affordablemobiles/GServerlessSupportLaravel","owner":"affordablemobiles","description":"Run Laravel on Google Serverless","archived":false,"fork":false,"pushed_at":"2024-12-11T10:32:28.000Z","size":1608,"stargazers_count":26,"open_issues_count":0,"forks_count":17,"subscribers_count":6,"default_branch":"php8.3-laravel11.x","last_synced_at":"2024-12-20T00:02:52.226Z","etag":null,"topics":["appengine","appengine-php","cloud-run","gae","gcr","google-appengine","google-cloud","google-cloud-run","laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/affordablemobiles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-03T10:24:23.000Z","updated_at":"2024-12-11T10:32:26.000Z","dependencies_parsed_at":"2024-04-15T15:29:42.091Z","dependency_job_id":"28fdfeb3-de0e-4c6d-8e7b-7c3d7c6542f4","html_url":"https://github.com/affordablemobiles/GServerlessSupportLaravel","commit_stats":{"total_commits":452,"total_committers":11,"mean_commits":41.09090909090909,"dds":"0.17035398230088494","last_synced_commit":"faea11f8b7395ed39bb430e2abb8c0db21105e6f"},"previous_names":["affordablemobiles/gaesupportlaravel","affordablemobiles/gserverlesssupportlaravel","a1comms/gaesupportlaravel"],"tags_count":187,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affordablemobiles%2FGServerlessSupportLaravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affordablemobiles%2FGServerlessSupportLaravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affordablemobiles%2FGServerlessSupportLaravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affordablemobiles%2FGServerlessSupportLaravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/affordablemobiles","download_url":"https://codeload.github.com/affordablemobiles/GServerlessSupportLaravel/tar.gz/refs/heads/php8.3-laravel11.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478323,"owners_count":20945266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appengine","appengine-php","cloud-run","gae","gcr","google-appengine","google-cloud","google-cloud-run","laravel","php"],"created_at":"2024-11-21T11:12:02.151Z","updated_at":"2026-05-20T11:02:40.916Z","avatar_url":"https://github.com/affordablemobiles.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GServerlessSupportLaravel\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg alt=\"Latest Stable Version\" src=\"https://poser.pugx.org/affordablemobiles/g-serverless-support-laravel/v/stable?style=for-the-badge\"\u003e\n    \u0026nbsp;\n    \u003cimg alt=\"PHP Version Require\" src=\"https://poser.pugx.org/affordablemobiles/g-serverless-support-laravel/require/php?style=for-the-badge\"\u003e\n    \u0026nbsp;\n    \u003cimg alt=\"Monthly Downloads\" src=\"https://poser.pugx.org/affordablemobiles/g-serverless-support-laravel/d/monthly?style=for-the-badge\"\u003e\n    \u0026nbsp;\n    \u003cimg alt=\"Total Downloads\" src=\"https://poser.pugx.org/affordablemobiles/g-serverless-support-laravel/downloads?style=for-the-badge\"\u003e\n    \u0026nbsp;\n    \u003cimg alt=\"License\" src=\"https://poser.pugx.org/affordablemobiles/g-serverless-support-laravel/license?style=for-the-badge\"\u003e\n    \u003cbr\u003e\n    \u003cbr\u003e\n    \u003cimg alt=\"Google App Engine\" width=\"100\" src=\"docs/images/icons/app-engine.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\n    \u003cimg alt=\"Google Cloud Run\" width=\"100\" src=\"docs/images/icons/cloud-run.png\"\u003e\n    \u0026nbsp;\u0026nbsp;\n    \u003cimg alt=\"Google Operations Suite\" width=\"100\" src=\"docs/images/icons/operations-suite.png\"\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\nGoogle Serverless runtime support package for **Laravel 11.x**.\n\nSupporting Cloud Run \u0026 App Engine (Standard Environment) with the `php83` runtime.\n\nBased on original work for App Engine ([GaeSupportL5](https://github.com/shpasser/GaeSupportL5) using the `php55` runtime) by [@shpasser](https://github.com/shpasser).\n\n## Functionality\n* **Google Cloud Operations Suite** integration\n    * **Cloud Logging** destination with structured logs (see [docs/logging.md](docs/logging.md)).\n    * **Error Reporting** integration for aggregation of reported exceptions (see [docs/logging.md](docs/logging.md#error-reporting)).\n        * **Client Side JavaScript Error** ingestion (see [docs/client-side-error-report.md](docs/client-side-error-reporting.md)).\n    * **Cloud Trace** (via [opentelemetry](https://github.com/open-telemetry/opentelemetry-php)) (see [docs/trace.md](docs/trace.md))\n        * Distributed trace propagation via [Guzzle](src/AffordableMobiles/GServerlessSupportLaravel/Trace/Instrumentation/Guzzle/GuzzleInstrumentation.php#L70).\n        * Integration with [laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) (optional, see [docs/debugbar.md](docs/debugbar.md)).\n* **Identity Aware Proxy (IAP)** integration\n    * **Inbound authentication** via Laravel's Guards (optional, see [docs/iap-auth-verify.md](docs/iap-auth-verify.md)).\n    * **Outbound authentication** via Guzzle middleware (optional, see [docs/guzzle.md](docs/guzzle.md#authtokenmiddleware)).\n* **Cloud SQL** integration\n    * **IAM Authentication** (optional, see [docs/cloud-sql.md](docs/cloud-sql.md#iam-authentication)).\n    * Automatic failover between read replicas (optional, see [docs/cloud-sql.md](docs/cloud-sql.md#multiple-read-replicas)).\n    * **Query Insights** integration via [eloquent-sqlcommenter](https://github.com/affordablemobiles/eloquent-sqlcommenter) (optional, see [docs/cloud-sql.md](docs/cloud-sql.md#query-insights)).\n* **Cloud Firestore in Datastore mode** integration\n    * **Session handler** (optional, see [docs/sessions.md](docs/sessions.md)).\n    * **Eloquent driver** via [eloquent-datastore](https://github.com/affordablemobiles/eloquent-datastore).\n* Optimizations for containerized deployment\n    * `bootstrap/cache` generation before deployment (see [g-serverless:prepare](src/AffordableMobiles/GServerlessSupportLaravel/Console/GServerlessPrepareCommand.php)).\n    * Blade View Pre-Compiler (optional, see [docs/blade-pre-compile.md](docs/blade-pre-compile.md))\n    * Automatic retries for outbound connections on network layer failure with Guzzle (optional, see [docs/guzzle.md](docs/guzzle.md#guzzleretrymiddleware))\n* [Domain Wide Delegation (DWD)](src/AffordableMobiles/GServerlessSupportLaravel/Integration/Google/Credentials/GCEDWDCredentials.php#L12) support via [IAM Credentials API](https://cloud.google.com/iam/docs/reference/credentials/rest) (no key file required).\n* [IAMSigner](src/AffordableMobiles/GServerlessSupportLaravel/Integration/JWT/Signer/IAMSigner.php) for [lcobucci/jwt](https://github.com/lcobucci/jwt) using [IAM Credentials API](https://cloud.google.com/iam/docs/reference/credentials/rest).\n* Examples for push-to-deploy from Git via Cloud Build with Secret Manager (see [docs/cloudbuild.md](docs/cloudbuild.md))\n\n## Installation\n\n**1.** Pull in the package via Composer:\n\n```js\n    \"require\": {\n        \"affordablemobiles/g-serverless-support-laravel\": \"~11\"\n    }\n```\n\n**2.** Add the following to `composer.json`:\n\n```json\n    \"scripts\": {\n        \"post-autoload-dump\": [\n            \"php artisan g-serverless:prepare\"\n        ]\n    },\n```\n\nThis is to automatically run the artisan command that prepares our app for deployment after composer finishes running: this creates any necessary cache files and if enabled, pre-compiles all of the blade views.\n\nIf you are deploying with Cloud Build, `composer install` is likely to run just before packaging/deployment to your chosen serverless product, so this will ensure everything else required runs as part of that step.\n\n**3.** Update the `use` statement at the top of `bootstrap/app.php` from:\n\n```php\nuse Illuminate\\Foundation\\Application;\n```\n\nto:\n\n```php\nuse AffordableMobiles\\GServerlessSupportLaravel\\Foundation\\Application;\n```\n\nThis will enable automatic exception reporting to Cloud Logging \u0026 Error Reporting, alongside adjusting the emergency logger to work correctly inside the containerized environment by writing to `stderr`.\n\n**Important:** the Logging API \u0026 the Trace API need to be enabled within your project, and the service account being used by your serverless app needs to have IAM permissions to use them:\n\n* [Enable the Logs API](https://console.cloud.google.com/apis/api/logging.googleapis.com/overview) - _append `?project=\u003cproject-name\u003e` to the URL if necessary._\n* Assign the IAM permission \"Logs Writer\" to your service account.\n* [Enable the Trace API](https://console.cloud.google.com/apis/api/cloudtrace.googleapis.com/overview) - _append `?project=\u003cproject-name\u003e` to the URL if necessary._\n* Assign the IAM permission \"Cloud Trace Agent\" to your service account.\n\n**4.** Configure the service providers within `config/app.php` by adding:\n\n```php\n    /*\n    |--------------------------------------------------------------------------\n    | Autoloaded Service Providers\n    |--------------------------------------------------------------------------\n    |\n    | The service providers listed here will be automatically loaded on any\n    | requests to your application. You may add your own services to the\n    | arrays below to provide additional features to this application.\n    |\n    */\n\n    'providers' =\u003e \\Illuminate\\Support\\ServiceProvider::defaultProviders()-\u003emerge([\n        // Package Service Providers...\n        \\AffordableMobiles\\GServerlessSupportLaravel\\GServerlessSupportServiceProvider::class,\n        \\AffordableMobiles\\GServerlessSupportLaravel\\Auth\\AuthServiceProvider::class,\n        \\AffordableMobiles\\GServerlessSupportLaravel\\Database\\DatabaseServiceProvider::class,\n    ])-\u003ereplace([\n        \\Illuminate\\View\\ViewServiceProvider::class =\u003e \\AffordableMobiles\\GServerlessSupportLaravel\\View\\ViewServiceProvider::class,\n    ])-\u003etoArray(),\n```\n\n**5.** Add the following environment variables:\n\n_This can be done either in `.env`, inside `app.yaml`, or as part of the Cloud Run service configuration - we recommend the latter two options where possible._\n\n```\nLOG_CHANNEL=stderr\nLOG_STDERR_FORMATTER=AffordableMobiles\\GServerlessSupportLaravel\\Log\\Formatter\\JsonFormatter\n\nCACHE_STORE=array\n\nSESSION_DRIVER=datastore\n```\n\nWhen using Cloud Tasks, you'll also want to configure:\n\n```\nCLOUD_TASKS_REGION=europe-west1 (or similar, required)\nTASK_QUEUE_SERVICE_ACCOUNT=\u003cproject-name\u003e@appspot.gserviceaccount.com (default, required for Cloud Run)\nOIDC_AUDIENCE=\u003cOAuth2 Client ID used by IAP, if enabled for inbound calls to your app\u003e (required for Cloud Run)\n```\n\nIf you are using an external CDN such as Cloudflare, also configure the following environment variable with the name of the HTTP header used for passing the client's IP address:\n\n```\nSOURCE_IP_HEADER=CF-Connecting-IP\n```\n\nAnd if you need to disable OpenTelemetry tracing (we highly recommend you leave it enabled), define the following environment variable:\n\n```\nG_SERVERLESS_TRACE_STOP=true\n```\n\nAlso, if running in a development environment, please also set the following:\n\n```\nG_SERVERLESS_DEVELOPMENT=true\n```\n\nThis does several things, such as:\n\n* Alters the local storage location to include `HTTP_HOST`.\n* Turns OpenTelemetry tracing on for every request.\n* Turns off sticky database connections per instance.\n\n## Upgrading (from Laravel 9.x LTS)\n\n**1.** Update the package version in `composer.json`:\n\n```json\n    \"require\": {\n        \"affordablemobiles/g-serverless-support-laravel\": \"~11\"\n    }\n```\n\n**2.** Follow the Laravel upgrade steps for all versions 9.x ... 11.x\n\n**3.** Update any references in your code to our namespace:\n\n`A1comms\\GaeSupportLaravel`\n\nhas changed to:\n\n`AffordableMobiles\\GServerlessSupportLaravel`\n\n**4.** Ensure `bootstrap/app.php` is extending our `Application` class:\n\nPlease see step 3 in the main installation guide as an example.\n\n**5.** Change to the new provider configuration format in `config/app.php`:\n\nPlease see step 4 in the main installation guide as an example.\n\n**6.** Update explicit/silent exception reporting:\n\nAnywhere referencing the Error Reporting integration class directly:\n\n`AffordableMobiles\\GServerlessSupportLaravel\\Integration\\ErrorReporting::exceptionHandler($e);`\n\nshould be updated to report using Laravel's new method:\n\n`report($e);`\n\n**7.** Revert `config/logging.php` to the Laravel default.\n\n**8.** Update environment variables:\n\nPlease see step 5 in the main installation guide \u0026 update your environment variables accordingly.\n\n**9.** If you are using `php-gds` for Datastore, consider switching to [eloquent-datastore](https://github.com/affordablemobiles/eloquent-datastore).\n\nOtherwise, you'll need to require it via composer yourself, as it is no longer required by this repository.\n\n**10.** If using the `lcobucci/jwt` compatible DWDTokenSource, it has now been removed.\n\nMigrate to the `google/auth` compatible [GCEDWDCredentials](src/AffordableMobiles/GServerlessSupportLaravel/Integration/Google/Credentials/GCEDWDCredentials.php).\n\n**11.** Update your `app.yaml` file(s) to specify `runtime: php83`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffordablemobiles%2Fgserverlesssupportlaravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faffordablemobiles%2Fgserverlesssupportlaravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffordablemobiles%2Fgserverlesssupportlaravel/lists"}