承接 miguilim/antibotlinks 相关项目开发

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

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

miguilim/antibotlinks

Composer 安装命令:

composer require miguilim/antibotlinks

包简介

An easy to install self-hosted image captcha library implemented with PHP + InterventionImage.

README 文档

README

AntiBotLinks is an easy to install self-hosted image captcha library. Through a predefined dictionary, the library generates images that must be selected in a specific order.

This captcha solution may not be 100% secure against bots, but in combination with other popular captcha services, it will be an extra layer of security for your platform.

example

Contents

Installation

You can install the package via composer:

composer require miguilim/antibotlinks

Usage

To get started with the package, you must use the make() static method and pass as first parameter an identifier string. This identifier parameter will be used to store & get the generated challenge and solution.

Use Miguilim\AntiBotLinks\AntiBotLinks;
use Miguilim\AntiBotLinks\CacheAdapters\SimpleFileCacheAdapter;

$antibotlinks = AntiBotLinks::make('1', new SimpleFileCacheAdapter(__DIR__ . '/cache'));

var_dump($antibotlinks->generateLinks());

Generally you should use the user id, ip address, or a generated cookie.

Cache Adapters

In order to use the AntiBotLinks class, you will need to choose a cache adapter so it can store the generated challenges somewhere. The package ships by default with the following adapters:

  • \Miguilim\AntiBotLinks\CacheAdapters\LaravelCacheAdapter
  • \Miguilim\AntiBotLinks\CacheAdapters\SimpleFileCacheAdapter

However, you can create and use your own adapter extending the abstract adapter class:

use Miguilim\AntiBotLinks\CacheAdapters\AbstractCacheAdapter;

class MyCustomCacheAdapter extends AbstractCacheAdapter
{
    public function remember(string $key, int $expiresIn, callable $callback): mixed
    {
        //
    }

    public function get(string $key): mixed
    {
        //
    }

    public function forget(string $key): bool
    {
        //
    }
}

Generate Links

You can generate / retrieve captcha links using the generateLinks() method. You can pass as first parameter the amount of links to generate. This method gets the generated links value from the cache, and generate if links are not found.

$links = $antibotlinks->generateLinks(amount: 3);

Validate Answer

You can validate the user answer with the validateAnswer() method.

$antibotlinks->validateAnswer($answer);

Flush Links

You can flush the current cache value and force re-generate a new captcha challenge. It's highly recommended to use this method when the user sends a wrong a answer.

$antibotlinks->flushLinks();

Customize Options

There are some few options that you can enable / disable when generating AntiBotLinks image.

// Enable or Disable image noise (Default: true)
$antibotlinks->noise(value: false);

// Enable or Disable image background (Default: false)
$antibotlinks->background(value: true);

// Enable or Disable dark theme (Default: false)
$antibotlinks->darkTheme(value: true);

You can also customize the word universe. You can overwrite the word universe or merge your array with the default one.

$wordUniverse = [...];

$antibotlinks->wordUniverse($wordUniverse);
// Or...
$antibotlinks->mergeWordUniverse($wordUniverse);

License

AntiBotLinks is open-sourced software licensed under the MIT license.

This Library is inspired by "AntiBotLinks" from FBU Script created by MakeJar.

miguilim/antibotlinks 适用场景与选型建议

miguilim/antibotlinks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.78k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2023 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 4.78k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-07