PHP code example of xpx / laravel-micro-service
1. Go to this page and download the library: Download xpx/laravel-micro-service library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xpx / laravel-micro-service example snippets
···
'service_center_driver' => [
// 默认使用
'default' => env('MICRO_SERVICE_SERVICE_CENTER_DRIVER_DEFAULT', 'local'),
// 本地驱动
'local' => \Gzoran\LaravelMicroService\Clients\ServiceCenterDrivers\LocalServiceCenterDriver::class,
// 远程驱动
'remote' => \Gzoran\LaravelMicroService\Clients\ServiceCenterDrivers\RemoteServiceCenterDriver::class,
],
···
···
'server_nodes' => [
···
// 开发环境
'local' => [
[
// 服务端名称
'server_name' => 'demo_server',
// 节点列表
'nodes' => [
[
'scheme' => 'http', // 协议
'host' => 'www.demo.com', // 主机地址
'port' => 80, // 端口
'path' => 'rpc/demo-server', // 路径
],
],
],
],
···
],
···
···
'service_center_nodes' => [
···
// 开发环境
'local' => [
[
'scheme' => 'http', // 协议
'host' => 'www.demo.com', // 主机地址
'port' => 80, // 端口
'path' => 'rpc/demo-server', // 路径
],
],
···
],
···
shell
php artisan vendor:publish --provider="Gzoran\LaravelMicroService\LaravelMicroServiceProvider"