Download the PHP package ssh/nacos-sdk-php without Composer

On this page you can find all versions of the php package ssh/nacos-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nacos-sdk-php

Nacos SDK for PHP

PHP SDK for Nacos service discovery and configuration management.

安装

功能特性

使用方法

初始化客户端

配置管理

1. 发布配置

2. 获取配置

3. 删除配置

4. 监听配置变更

服务发现

1. 注册服务实例

2. 注销服务实例

3. 获取所有服务实例

4. 获取单个健康实例

服务调用

1. 调用服务(GET方法)

2. 调用服务(POST方法)

3. 调用服务(通用方法)

4. 获取健康实例

5. 构建服务URL

6. 清除缓存

7. 配置HTTPS

在注册服务时,通过元数据设置securetrue来启用HTTPS:

Feign风格声明式客户端

FeignClient提供了声明式的API调用方式,类似Java的OpenFeign,让服务调用更加简单直观。

1. 创建Feign客户端

2. GET请求

3. POST请求

4. PUT请求

5. DELETE请求

6. 通用请求方法

7. 自定义重试次数

8. 同时使用多个Feign客户端

9. FeignClient与ServiceInvoker对比

ServiceInvoker方式:

FeignClient方式(推荐):

FeignClient方式更加简洁,不需要每次都指定服务名,代码更易读。

gRPC功能使用

SDK 支持 Nacos 9848 端口的 gRPC 服务,可以通过 gRPC 协议与 Nacos 服务器通信,获得更好的性能。

1. 使用 gRPC 客户端

2. 使用 gRPC 进行配置管理

3. 使用 gRPC 进行服务发现

注意:SDK 会自动检测 gRPC 服务可用性。如果 gRPC 服务不可用,会自动回退到 HTTP 协议,确保功能正常。

测试

SDK提供了完整的测试脚本:

分步测试

这个脚本会依次测试所有功能:

配置监听测试

这个脚本会演示如何监听配置变更。

gRPC 功能测试

这个脚本会测试 gRPC 客户端功能,包括:

系统要求

启动Nacos服务器

要完全测试SDK功能,需要启动Nacos服务器:

  1. 下载Nacos服务器:https://github.com/alibaba/nacos/releases
  2. 解压并运行:

  3. 访问 http://localhost:8848/nacos 确认服务器运行
    • 默认用户名:nacos
    • 默认密码:nacos

项目结构

许可证

MIT License


All versions of nacos-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
guzzlehttp/guzzle Version ^6.0 || ^7.0
psr/log Version ^1.0 || ^2.0 || ^3.0
symfony/options-resolver Version ^5.0 || ^6.0
grpc/grpc Version ^1.30
google/protobuf Version ^3.15
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ssh/nacos-sdk-php contains the following files

Loading the files please wait ...