eureciclo/gae-support-laravel
Composer 安装命令:
composer require eureciclo/gae-support-laravel
包简介
Google App Engine (Standard and Flexible Environment) runtime support for Laravel apps.
README 文档
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
eureciclo/gae-support-laravel 适用场景与选型建议
eureciclo/gae-support-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.3k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 eureciclo/gae-support-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eureciclo/gae-support-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-05