lushdigital / microservice-remote-models
Lumen 包,用于为分布式数据提供熟悉的模型范式。
v0.6.0
2017-11-17 13:24 UTC
Requires
- php: >=5.6.4
- grpc/grpc: ^1.2
- guzzlehttp/guzzle: ^6.2
- guzzlehttp/promises: ^1.3
- laravel/lumen-framework: 5.3.*
- lushdigital/microservice-model-utils: ^1.0
Requires (Dev)
- apigen/apigen: 4.2.x-dev
- phpunit/phpunit: ~5.0
README
Lumen 包,用于为分布式数据提供熟悉的模型范式。
描述
此包提供了一个类似于 Eloquent 的模型系统,但关键关注点在于分布式数据。每个模型类都绑定到一个具有预期 RESTful API 的远程微服务。这允许开发者创建服务聚合器,通过模型来操作数据,就像数据在本地数据库中一样简单。
为了使这一点可行,包对远程服务中的请求/响应数据有一定的看法。这些数据应始终符合以下标准
https://github.com/LUSHDigital/microservice-core/blob/master/spec/swagger.yaml
此包旨在在 Kubernetes 集群中运行,其中服务发现由 DNS 名称处理。
关系
该包还通过使用 gRPC 处理远程模型之间的关系。除了为远程模型提供动力的微服务外,还期望有一个 gRPC 应用程序来管理这些关系。此 gRPC 应用程序基于此 协议缓冲区。
有关 DNS 和端口的详细信息,请参阅配置文档。
安装
正常安装包
$ composer require lushdigital/microservice-remote-models
在 bootstrap/app.php 文件中将服务提供者注册到 Lumen
$app->register(LushDigital\MicroServiceRemoteModels\RemoteModelServiceProvider::class);
该包要求在 bootstrap/app.php
中的 Lumen 配置中做出以下更改
<?php // Uncomment the line below to enable Facade support. $app->withFacades(); // Uncomment the line below to enable Eloquent ORM support. $app->withEloquent(); // Add the line below to load database config. This is required for caching to work. $app->configure('database');