承接 jsobeslav/webproxy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jsobeslav/webproxy

Composer 安装命令:

composer require jsobeslav/webproxy

包简介

WebProxy is PHP library that offers consistent interface for communicating with standard third-party web services, be it API or an ordinary website

README 文档

README

  • WebProxy is PHP library that offers consistent interface for communicating with standard third-party web services, be it API or an ordinary website.
  • It offers parsing JSON response from REST API, scrapping and crawling HTML code from website, or calling methods on SOAP services.
  • To clarify certain potential misconceptions, please see terminology chapter below.

Included libraries / dependencies

Usage

Examples

  • For implemented examples, see demo folder.

General guide

  • Create Service class that extends suitable child
    • Options are:
      • RestApi (for REST APIs)
      • Website (for crawling trough Websites)
      • SoapService (for SOAP APIs)
    • Fill in the missing interface methods
      • getUri(): return base URI where service is located.
        • For HttpService it's base URI. E.q. return 'https://jsonplaceholder.typicode.com';
        • For SoapService it's WSDL URI. E.q. return 'https://soapexample.com?wsdl';
  • Create Endpoint classes that extends children appropriate to selected Service type
    • Options are:
      • RestResource (for RestApi)
      • Webpage (for crawling trough Website)
      • SoapEndpoint (for SoapService)
    • Fill in the missing interface methods, and optional class variables
      • getServiceClass(): Return class of appropriate service. E.q. return JsonPlaceholderRestApi::class;
      • getRequestName(): Return specification of request that the endpoint performs.
        • For HttpService, it's URI appendend after base Service URI. E.q. return '/posts';
        • For SoapService, it's method name. E.q. return 'getPosts';
      • $supportedMethods: Optional whitelist for HttpServices. E.q. return [Method::POST];
    • Write methods to filter the results
      • For RestResource, utilize parsed data object: return $this->getResponseData()['id'];
      • For Websites, utilize Symfony DOM Crawler: return $this->getCrawler()->filter('.address h3')->text();
      • For SoapEndpoints, utilize parsed data: return $this->getResponseData()['result'];
  • Initialize WebProxy object (new WebProxy()) and desired endpoints (new ExampleResource())
  • Pass new instance of the custom endpoint to WebProxy trough one of its methods
    • get, post, put, delete as shorthands for HTTP Requests
    • httpRequest for customized HTTP Requests
    • call as shorthand for SOAP request
    • soapRequest for customized SOAP Requests
  • for specific purposes, you might want to use httpRequest and soapRequest methods with custom Request object
    • For example, default POST body type is Form-data, or Multipart (if files are sent with it). To send JSON, use Request::create(Method::POST)->withJsonBody(['array','content])
    • pass instance of the Request as second parameter to mentioned methods
  • Use returned modified instance of endpoint to return parsed data

Terminology used

  • Client: A class that is responsible for performing request on Endpoint located on Service, and fetching the response body
    • HttpClient: Contains single Guzzle instance to perform all requests
    • SoapClient: Passes requests to every independent SoapService's own instance of native SoapClient
  • Service: A collection of endpoints located on single domain.
    • HttpService: Service acessible trough HTTP requests
      • RestApi: REST API containing multiple RestResources
      • Website: Site containg multiple Webpages
    • SoapService: Service accessible trough SOAP calls
  • Endpoint: One specific function of Service
    • HttpEndpoint: Specific URI on HttpService
      • RestResource: RESTful HttpEndpoint
      • Webpage: HttpEndpoint that returns HTML
    • SoapEndpoint: A method of SoapService

jsobeslav/webproxy 适用场景与选型建议

jsobeslav/webproxy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 133 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jsobeslav/webproxy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jsobeslav/webproxy 我们能提供哪些服务?
定制开发 / 二次开发

基于 jsobeslav/webproxy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 133
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: CC-BY-4.0
  • 更新时间: 2019-01-17