承接 district5/php-postman-detect 相关项目开发

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

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

district5/php-postman-detect

最新稳定版本:0.0.1

Composer 安装命令:

composer require district5/php-postman-detect

包简介

Postman detector is a PHP library that detects if a request has been made by Postman.

README 文档

README

Prevent or restrict access to certain API endpoints when using Postman for mock requests.

Usage...

"repositories":[
    {
        "type": "vcs",
        "url": "git@github.com:district-5/php-postman-detect.git"
    }
],

"require": {
    "district5/php-postman-detect": ">=0.0.1"
}

Code usage...

<?php

$_SERVER['HTTP_USER_AGENT'] = 'PostmanRuntime/7.26.8';
\District5\PostmanDetect\PostmanDetector::isPostman(); // true

$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko)';
\District5\PostmanDetect\PostmanDetector::isPostman(); // false


$_SERVER['HTTP_USER_AGENT'] = 'PostmanRuntime/7.26.8';

// Disallow this endpoint with Postman always
\District5\PostmanDetect\PostmanDetector::disallowAlways(); // throws exception

// Current environment is 'local'
// disallow on production
\District5\PostmanDetect\PostmanDetector::disallowOnEnvs('local', ['prod']); // no exception
// disallow on production and staging
\District5\PostmanDetect\PostmanDetector::disallowOnEnvs('local', ['prod', 'staging']); // no exception

// Current environment is 'prod'
// disallow on production
\District5\PostmanDetect\PostmanDetector::disallowOnEnvs('prod', ['prod']); // throws exception
// disallow on production and staging
\District5\PostmanDetect\PostmanDetector::disallowOnEnvs('prod', ['prod', 'staging']); // throws exception

Testing...

composer install
./vendor/bin/phpunit

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2023-07-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固