Download the PHP package erikwang2013/poster-php without Composer

On this page you can find all versions of the php package erikwang2013/poster-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package poster-php

poster-php

PHP 图片验证码与海报生成工具包 —— 框架无关核心 + Laravel / ThinkPHP / Webman / Hyperf 适配。

架构设计图

功能

验证码(三种方式 + 随机切换)

类型 说明
点击验证 click 用户按顺序点击图片上的目标文字
旋转验证 rotate 用户拖动滑块将图片旋转回正确角度
滑块验证 slider 用户拖动拼图块到缺口位置
随机切换 random 随机选取以上三种验证码之一

海报生成

链式 Builder API,支持 14 种元素:

元素 方法 说明
文字 addText() 自动换行,对齐,多行
图片 addImage() 缩放裁剪,圆角,阴影
头像 addAvatar() 圆形裁剪,边框
二维码 addQrcode() 纯 PHP 生成,中心 Logo,底部文案
形状 addShape() 矩形/圆形/圆角,填充/描边
分割线 addLine() 颜色,宽度
水印 addWatermark() 平铺文字,角度,间距
表格 addTable() 表头,斑马纹,列宽
图表 addChart() 柱状图 / 折线图 / 饼图
日历 addCalendar() 月历,高亮日期,标注
艺术字体 addArtisticText() 描边 / 阴影 / 渐变 / 霓虹
Emoji addEmoji() 彩色 emoji 表情渲染
字体图标 addIcon() FontAwesome 图标渲染
颜文字 addEmoticon() 日式颜文字 / 自定义表情

安装

系统要求:PHP >= 8.0,GD 扩展。

可选扩展:

使用说明

一、验证码

1. 点击验证码 (ClickCaptcha)

用户需要按顺序点击图片上的目标文字(如"树""鸟""花"),验证人类操作。

2. 旋转验证码 (RotateCaptcha)

系统随机旋转图片 30°~330°,用户拖动滑块将图片旋转回正。

3. 滑块验证码 (SliderCaptcha)

系统从背景切出拼图块并偏移,用户拖动拼图到缺口位置。

4. 随机切换 (RandomCaptcha)

系统随机从 click / rotate / slider 中选取一种验证码,增加破解难度。

验证安全特性

特性 说明
一次性 验证成功/超过最大次数后 key 删除
防暴力 默认最多验证 3 次(可配置)
有效期 默认 300 秒(可配置)
随机性 每次生成的背景颜色、噪声、目标位置均随机
背景美化 程序化渐变背景,三种风格(简约/活泼/自然)随机切换,支持配置默认背景图目录

背景图片配置

验证码背景支持三级优先级:

  1. 单张图片 — 通过 setBackground('/path/to/bg.jpg') 指定
  2. 图片目录 — 配置 captcha.background_dir 指向图片目录,默认指向 assets/backgrounds/(内置 6 张精美渐变背景图)
  3. 程序化生成 — 设 background_dirnull 时启用,三种风格随机切换

默认背景图assets/backgrounds/ 自带 6 张 400×250 PNG 渐变背景,风格包括蓝紫、日落、清新绿、暗黑、粉彩、海洋蓝。

三种程序化风格:

风格 说明
minimal 简约 柔和渐变 + 大尺寸低透明度圆形 + 几何线条 + 稀疏细点
vibrant 活泼 明亮渐变 + 多种大小彩色圆形 + 中等密度噪点
natural 自然 暖色渐变 + 不规则色块模拟纸张纹理 + 细微密点

二、海报生成

基础用法

文字 addText()

图片 addImage()

头像 addAvatar()

二维码 addQrcode()

形状 addShape()

分割线 addLine()

水印 addWatermark()

表格 addTable()

图表 addChart()

日历 addCalendar()

艺术字体 addArtisticText()

Emoji addEmoji()

系统会自动检测 macOS / Linux / Windows 上的 emoji 字体路径。

字体图标 addIcon()

颜文字 addEmoticon()

三、模板系统

框架集成

Laravel

ThinkPHP

config/web.php:

Webman

config/bootstrap.php:

Hyperf

通过 ConfigProvider 自动注册。

配置

composer require 后自动将 config/poster.php 复制到项目 config/ 目录(已存在则跳过)。兼容 Laravel / ThinkPHP / Webman(config/poster.php)和 Hyperf(config/autoload/poster.php)。

主要配置项:

配置项 默认值 说明
captcha.default_type random 默认验证码类型:click / rotate / slider / random
captcha.default_difficulty medium 默认难度:easy / medium / hard
captcha.click_words [合,家,欢,...] click 验证码文字池,可自定义
captcha.background_dir assets/backgrounds/ 背景图目录,null 则程序化生成
captcha.ttl 300 验证码有效期(秒)
captcha.max_attempts 3 最大验证次数
captcha.tolerance {click:18,rotate:5,slider:4} 各类型容差
image.driver auto 图像驱动:auto / gd / imagick

目录结构

开源不易,欢迎支持

微信 支付宝

License

MIT License — Copyright (c) 2026 erik https://erik.xyz


All versions of poster-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-gd Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package erikwang2013/poster-php contains the following files

Loading the files please wait ...