cryental/php-wifi 问题修复 & 功能扩展

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

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

cryental/php-wifi

最新稳定版本:1.0.0

Composer 安装命令:

composer require cryental/php-wifi

包简介

PHP library for working with wifi network

README 文档

README

Build Status codecov Maintainability StyleCI Quality Score

PHP WiFi

PHP WiFi is cross-platform php library based on integrated in OS utilities

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

Require this package, with Composer, in the root directory of your project.

$ composer require sanchescom/php-wifi

Usage

<?php

include __DIR__ . '/vendor/autoload.php';

use Sanchescom\WiFi\WiFi;

class Example
{
    public $device;

    /**
     * @throws Exception
     */
    public function getAllNetworks()
    {
        $networks = WiFi::scan()->getAll();

        foreach ($networks as $network) {
            echo $network . "\n";
        }
    }

    /**
     * @param $ssid
     * @param $password
     */
    public function connect($ssid, $password)
    {
        try {
            WiFi::scan()->getBySsid($ssid)->connect($password, $this->device);
        } catch (Exception $exception) {
            echo $exception->getMessage();
        }
    }

    /**
     * @throws Exception
     */
    public function disconnect()
    {
        $networks = WiFi::scan()->getConnected();

        foreach ($networks as $network) {
            $network->disconnect($this->device);
        }
    }
}

$example = new Example();
try {
    $example->device = 'en1';
    $example->getAllNetworks();
    $example->connect('Redmi', '12345');
    $example->disconnect();
} catch (Exception $e) {
    //
}

Running in console:

List of found wifi networks

$ ./vendor/bin/wifi list

List connected wifi networks

$ ./vendor/bin/wifi list --connected

Connect to wifi network

$ ./vendor/bin/wifi connect --bssid=4c:49:e3:f5:35:17 --password=12345 --device=en1

Disconnect from wifi network

$ ./vendor/bin/wifi disconnect --bssid=4c:49:e3:f5:35:17 --device=en1

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Platform support

  • Linux
  • MacOS
  • Windows

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2024-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固