定制 knotsphp/flushdns 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

knotsphp/flushdns

最新稳定版本:v1.0.0

Composer 安装命令:

composer require knotsphp/flushdns

包简介

Flush DNS cache on your system

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require GitHub Workflow Status (with event)

FlushDNS is a PHP library to flush the DNS cache of the current machine.

It also provides a command line utility: flushdns.

Compatible with MacOS, Linux, and Windows.

🚀 Installation

composer require knotsphp/flushdns

📚 Usage

use KnotsPHP\FlushDNS\FlushDNS;

// Flush DNS cache
$success = FlushDNS::run(); 

// Only get the command
$command = FlushDNS::getCommand();

// Check if the command needs elevated privileges
$needsElevation = FlushDNS::needsElevation();

This library also comes some helpers fnuctions for Curl:

// Get options to ignore dns cache
$flushDnsOptions = FlushDNS::getCurlOpts();

// Make the request
$curl = curl_init();
curl_setopt_array($curl, array_merge(
    [
        CURLOPT_URL => "https://app.unolia.com/api/v1/domains",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            "Accept: application/json",
            "Authorization: Bearer 123"
        ],
    ],
    $flushDnsOptions,
));
$response = curl_exec($curl);
$domains = json_decode($response);
curl_close($curl);

📚 Use in command line

You can also use this library in the command line by using the flushdns command.

It's recommended to install the library globally to use it in the command line.

composer global require knotsphp/flushdns

Then you can use the flushdns command to get the public IP address of the current machine.

# In your project directory
vendor/bin/flushdns

# Globally installed
flushdns

📖 Documentation

This library is compatible with MacOS, Linux, and Windows.

Some operating systems may require root access to flush the DNS cache.

📋 TODO

  • Add argument to public static method to get a command for a specific OS. (needs knotsphp/system updated)
  • Add support for more operating systems.
  • Add support for running elevated commands on MacOS and Linux by passing the password as an argument or having a gui prompt depending of the context. (needs knotsphp/elevated to be written)

🤝 Contributing

Clone the project and run composer update to install the dependencies.

Before pushing your changes, run composer qa.

This will run pint (code style), phpstan (static analysis), and pest (tests).

👥 Credits

FlushDNS was created by Eser DENIZ.

📝 License

FlushDNS is licensed under the MIT License. See LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固