hubchain / gae-support-laravel
为 Laravel 应用程序提供 Google App Engine (标准环境和灵活环境) 运行时支持。
Requires
- php: >=7.2.0
- a1comms/php-gds: ~4.2
- google/cloud: >=0.100.0 <1.0.0
- guzzlehttp/guzzle: ~6
- kelvinmo/simplejwt: ^0.2.4
- opencensus/opencensus-exporter-stackdriver: ~0
- dev-php72-laravel55
- v5.5.40
- v5.5.39
- v5.5.38
- v5.5.37
- v5.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-php7.3-laravel6.0
- dev-iamacarpet/pushtask-timestamp-fix
- dev-master
- dev-php55-laravel51-compat
This package is auto-updated.
Last update: 2024-09-18 03:17:52 UTC
README
为 Laravel 5.5 LTS 提供的 Google App Engine (GAE) 标准环境和灵活环境支持包。
基于 @shpasser 在 App Engine 标准环境(PHP5.5 运行时)上的原始工作 https://github.com/shpasser/GaeSupportL5
此库旨在实现标准环境和灵活环境之间的同构操作。
注意:我们只打算支持 Laravel LTS 版本,本版本特别针对 Laravel 5.5 LTS
功能
- StackDriver 日志集成
- StackDriver 追踪集成(见 docs/trace.md)
- Blade 视图预编译器(可选,见 docs/blade-pre-compile.md)
- Guzzle 集成(可选,见 docs/trace.md)
- Laravel Auth 集成 IAP(可选,见 docs/iap-auth-verify.md)
- Cloud Tasks 的队列驱动程序(可选,见 docs/queue.md)
- 从 Git 部署的示例,以及使用 KMS 加密的密钥(可选,见 docs/cloudbuild.md)
安装
通过 Composer 引入此包。
"require": { "a1comms/gae-support-laravel": "~5.5" }
Laravel 特定(非 Lumen)
1. 在 composer.json
中添加以下内容
"scripts": { "post-autoload-dump": [ "php artisan gae:prepare" ] },
2. 对于 Laravel,在 config/app.php
中包含服务提供者
'providers' => [ A1comms\GaeSupportLaravel\GaeSupportServiceProvider::class, ];
3. 此外,为了增加功能,包含可选的服务提供者
'providers' => [ A1comms\GaeSupportLaravel\Auth\AuthServiceProvider::class, A1comms\GaeSupportLaravel\View\ViewServiceProvider::class, A1comms\GaeSupportLaravel\Queue\QueueServiceProvider::class, A1comms\GaeSupportLaravel\Trace\TraceServiceProvider::class, ];
并移除这些服务提供者所替换的相关 Laravel 服务提供者
'providers' => [ //Illuminate\View\ViewServiceProvider::class, //Illuminate\Queue\QueueServiceProvider::class, ];
4. 更新 bootstrap/app.php
以加载覆盖的应用程序类并将日志初始化到 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( realpath(__DIR__.'/../') ); /* |-------------------------------------------------------------------------- | Setup Early Logging |-------------------------------------------------------------------------- */ A1comms\GaeSupportLaravel\Log\Logger::setup($app);
5. 更新 app/Exceptions/Handler.php
以启用适当的异常记录到 StackDriver 错误报告和日志
更改以下 use
语句
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
到我们的类,它将注入所需的日志钩子
use A1comms\GaeSupportLaravel\Foundation\Exceptions\Handler as ExceptionHandler;
6. 在 .env
中设置以下内容
QUEUE_DRIVER=gae
CACHE_DRIVER=array
SESSION_DRIVER=gae
Lumen 特定(非 Laravel)
1. 更新 bootstrap/app.php
以加载覆盖的应用程序类
/* |-------------------------------------------------------------------------- | 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( realpath(__DIR__.'/../') );
2. 更新 app/Exceptions/Handler.php
以启用适当的异常记录到 StackDriver 错误报告和日志
更改以下 use
语句
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
到我们的类,它将注入所需的日志钩子
use A1comms\GaeSupportLaravel\Foundation\Exceptions\LumenHandler as ExceptionHandler;