madewithlove/htaccess-api-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

madewithlove/htaccess-api-client

Composer 安装命令:

composer require madewithlove/htaccess-api-client

包简介

API client for the best htaccess tester in the world.

README 文档

README

Build status Latest Stable Version License codecov

This is an API client to interact with the Htaccess tester.

Installation

composer require madewithlove/htaccess-api-client

Usage

The package can be used with every PSR-compatible http client. In this example, we're going to be using guzzle's PSR adapter.

use Http\Factory\Guzzle\ServerRequestFactory;
use Http\Adapter\Guzzle6\Client;
use Madewithlove\HtaccessClient

$client = new HtaccessClient(
    new Client(),
    new ServerRequestFactory()
);

$response = $client->test(
    'http://localhost',
    'RewriteRule .* /foo [R]'
);

$response->getOutputUrl(); // "http://localhost/foo"
$response->getLines();
/*
array(1) {
  [0]=>
  object(Madewithlove\ResultLine)#30 (5) {
    ["line":"Madewithlove\ResultLine":private]=> string(23) "RewriteRule .* /foo [R]"
    ["message":"Madewithlove\ResultLine":private]=> string(98) "The new url is http://localhost/foo
Test are stopped, a redirect will be made with status code 302"
    ["isMet":"Madewithlove\ResultLine":private]=> bool(true)
    ["isValid":"Madewithlove\ResultLine":private]=> bool(true)
    ["wasReached":"Madewithlove\ResultLine":private]=> bool(true)
  }
}
*/

Server variables

Htaccess Tester supports passing server variables to be evaluated by the rewrite rules. We currently support the following variables.

Server variables can be passed to the test() and share() methods.

$serverVariables = ServerVariables::default()->with(
    'SERVER_NAME',
    'example.com'
);

$response = $client->test(
    'http://localhost',
    'RewriteCond %{SERVER_NAME} example.com
    RewriteRule .* /foo [R]',
    $serverVariables
);

$response = $client->share(
    'http://localhost',
    'RewriteCond %{SERVER_NAME} example.com
    RewriteRule .* /foo [R]',
    $serverVariables
);

统计信息

  • 总下载量: 33.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 23
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 7
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-11-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固