eureciclo / gae-support-laravel
Google App Engine (Standard and Flexible Environment) runtime support for Laravel apps.
Requires
- php: ^8.3
- a1comms/eloquent-datastore: ~11
- a1comms/eloquent-sqlcommenter: ~11
- a1comms/opencensus: ~0
- a1comms/opencensus-exporter-stackdriver: ~0
- firebase/php-jwt: ^6.3
- google/cloud: >=0.175.0 <1.0.0
- guzzlehttp/guzzle: ^7.4.1
- illuminate/cache: ~11
- illuminate/collections: ~11
- illuminate/console: ~11
- illuminate/container: ~11
- illuminate/contracts: ~11
- illuminate/encryption: ~11
- illuminate/filesystem: ~11
- illuminate/http: ~11
- illuminate/queue: ~11
- illuminate/support: ~11
- illuminate/view: ~11
- symfony/console: ^7.0
- xantios/mimey: ^2.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- phpmd/phpmd: @stable
Suggests
- a1comms/php-gds: Provides legacy Datastore support
- dev-dev-master
- v10.0.1
- v10.0.0
- 5.5.36
- v5.5.35
- v5.5.34
- v5.5.33
- v5.5.32
- v5.5.31
- v5.5.30
- v5.5.29
- v5.5.28
- v5.5.27
- v5.5.26
- v5.5.25
- v5.5.24
- v5.5.23
- v5.5.22
- v5.5.21
- v5.5.20
- v5.5.19
- v5.5.18
- v5.5.17
- v5.5.16
- v5.5.15
- v5.5.14
- v5.5.13
- v5.5.12
- v5.5.11
- v5.5.10
- v5.5.9
- v5.5.8
- v5.5.7
- v5.5.6
- v5.5.5
- v5.5.4
- v5.5.3
- v5.5.2
- v5.5.1
- 5.1.27
- 5.1.26
- 5.1.25
- 5.1.24
- 5.1.23
- 5.1.22
- 5.1.21
- 5.1.20
- 5.1.19
- 5.1.18
- 5.1.17
- 5.1.16
- 5.1.15
- 5.1.14
- 5.1.13
- 5.1.12
- 5.1.11
- 5.1.10
- 5.1.9
- 5.1.8
- 5.1.7
- 5.1.6
- v5.1.5
- 5.1.4
- 5.1.3
- v5.1.2
- 5.1.1
- 5.1.0
- dev-update-php-8-3
- dev-new-master
- dev-bugfix-undefined-var
- dev-php72-laravel55
- dev-php7.3-laravel6.0
- dev-iamacarpet/pushtask-timestamp-fix
- dev-master
- dev-php55-laravel51-compat
This package is not auto-updated.
Last update: 2024-10-18 12:02:47 UTC
README
Google App Engine (GAE) Standard Environment support package for Laravel 9.x.
Based on original work for App Engine Standard (on the PHP5.5 runtime) by @shpasser https://github.com/shpasser/GaeSupportL5
Note: we only intend to support Laravel LTS releases, with this version targeted specifically at Laravel 9.x
Functionality
- StackDriver Logging integration
- StackDriver Trace integration (see docs/trace.md)
- Blade View Pre-Compiler (optional, see docs/blade-pre-compile.md)
- Guzzle integration (optional, see docs/trace.md)
- Laravel Auth Integration for IAP (optional, see docs/iap-auth-verify.md)
- Queue Driver for Cloud Tasks (optional, see docs/queue.md)
- Examples for deployment from Git via Cloud Build, plus encrypted secrets with KMS (optional, see docs/cloudbuild.md)
Installation
Pull in the package via Composer:
"require": { "a1comms/gae-support-laravel": "~9.0" }
Laravel Specific (Not Lumen)
1. Add the following to composer.json
:
"scripts": { "post-autoload-dump": [ "php artisan gae:prepare" ] },
2. For Laravel, include the service provider within config/app.php
:
'providers' => [ A1comms\GaeSupportLaravel\GaeSupportServiceProvider::class, ];
3. Also, for added functionality, include the optional service providers:
'providers' => [ A1comms\GaeSupportLaravel\Auth\AuthServiceProvider::class, A1comms\GaeSupportLaravel\View\ViewServiceProvider::class, A1comms\GaeSupportLaravel\Queue\QueueServiceProvider::class, A1comms\GaeSupportLaravel\Trace\TraceServiceProvider::class, ];
And remove the relevant Laravel service providers that these replace:
'providers' => [ //Illuminate\View\ViewServiceProvider::class, //Illuminate\Queue\QueueServiceProvider::class, ];
4. Update bootstrap/app.php
to load the overridden application class & initialise logging to Stackdriver:
/* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | The first thing we will do is create a new Laravel application instance | which serves as the "glue" for all the components of Laravel, and is | the IoC container for the system binding all of the various parts. | */ $app = new A1comms\GaeSupportLaravel\Foundation\Application( $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) );
5. Update app/Exceptions/Handler.php
to enable proper Exception logging to StackDriver Error Reporting & Logging:
Change the following use
statement:
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
To our class, that'll inject the required logging hook:
use A1comms\GaeSupportLaravel\Foundation\Exceptions\Handler as ExceptionHandler;
6. In config/logging.php
, configure a custom logger and set it as the default:
It's also useful to set the emergency log path to a location App Engine will forward to Stackdriver Logging, see below.
<?php use A1comms\GaeSupportLaravel\Log\CreateLoggingDriver; return [ 'default' => 'gae', 'channels' => [ 'gae' => [ 'driver' => 'custom', 'via' => CreateLoggingDriver::class, ], 'emergency' => [ 'path' => '/var/log/emergency.log', ], ], ];
7. In .env
, set the following:
QUEUE_CONNECTION=gae
CACHE_DRIVER=array
SESSION_DRIVER=gae
LOG_CHANNEL=gae
Lumen Specific (Not Laravel)
1. Update bootstrap/app.php
to load the overridden application class
/* |-------------------------------------------------------------------------- | Create The Application |-------------------------------------------------------------------------- | | Here we will load the environment and create the application instance | that serves as the central piece of this framework. We'll use this | application as an "IoC" container and router for this framework. | */ $app = new A1comms\GaeSupportLaravel\Foundation\LumenApplication( $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) );
2. Update app/Exceptions/Handler.php
to enable proper Exception logging to StackDriver Error Reporting & Logging:
Change the following use
statement:
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
To our class, that'll inject the required logging hook:
use A1comms\GaeSupportLaravel\Foundation\Exceptions\LumenHandler as ExceptionHandler;
Upgrading (from Laravel/Lumen 6.x LTS)
Laravel Specific (Not Lumen)
1. Update the package version in composer.json
:
"require": { "a1comms/gae-support-laravel": "~9.0" }
2. Follow the Laravel upgrade steps for all versions 6.x ... 9.x
Lumen Specific (Not Laravel)
1. Update the package version in composer.json
:
"require": { "a1comms/gae-support-laravel": "~9.0" }
2. Follow the Lumen upgrade steps for all versions 6.x ... 9.x