mijohansen/php-gae-util
Composer 安装命令:
composer require mijohansen/php-gae-util
包简介
Utility belt for common tasks in Google App Engine for PHP.
README 文档
README
Utility belt for common tasks and patterns on Google App Engine for PHP. The goal is to make development of microservices on Google App Engine go fast and smooth. Handling common GAE scenarios with less code.
Modules
- Auth: Handles several issues around getting users autenticated.
- Cached: Just a simple wrapper for memcache for easier testing.
- Conf: A wrapper around
hassankhan/configwhich provides a lightweighhed library for handling config. - Fetch: Simple module to ensure service to service communication.
- JWT: A module to handle JWT-tokens. Wrapper around
firebase/php-jwt - Secrets: Module to handle keeping secrets secret. Using Google KMS to secure passwords and tokens.
- Workflow: Module to handle the running of scheduled tasks on GAE its main contribution is to store the state of the job running. Saves State to DataStore.
Login in to provide service account credentials in development
For local developent its important to get Application Default Credentials if you want to use resources on the Google Cloud platform. You log in by running this command:
$ gcloud auth application-default login
You need to restart the devserver to get this working as the credentials get set on startup time.
Testing and development
Testing
Test-coverage is an important part of creating reusable, reliable code. The goal of this testing is to use phpunit as this is the most used PHP test framework. As several methods are dependent on Cloud Datastore installing understanding and being able to test against the emulator is quite important. The emulator is not the same as the built in emulator that is running inside the GAE devserver emulator.
Cloud datastore setup for testing
$ gcloud components install cloud-datastore-emulator $ gcloud beta emulators datastore start --no-store-on-disk
or alternatively with docker:
$ docker run -d -p 8282:8282 --name datastore egymgmbh/datastore-emulator:latest
For local development of packages
My strategy for developing packages for packagist is as following.
- Create a local folder where you symlink packages
In ~/composer/config.json add, this also works with using the projects composer.json file, but
then you might get problems on other developers computers and in
pipelines.
{
"repositories": [
{
"type": "path",
"url": "~/path/to/liberary/root",
"options": {
"symlink": true
}
}
]
}
This will now create a link. Two tricks for getting a more problem free start of development is to add your liberary with "*" for and set minimum stability in the local composer.json for the liberary that requires your packages:
{
"minimum-stability": "dev",
"require": {
"mijohansen/php-gae-util": "*"
}
}
Coding style
The liberary consist of several separate Classes that really just form a set of functions which should be fairly simple to introduce to code. From version 0.7.0 every static method and function is written in camelCase. And I try to follow PSR-1 and PSR-2
Contributing
mijohansen/php-gae-util 适用场景与选型建议
mijohansen/php-gae-util 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 219 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 08 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mijohansen/php-gae-util 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mijohansen/php-gae-util 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 219
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-06