PHPackages                             kshan/postermaker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. kshan/postermaker

ActiveLibrary[Image &amp; Media](/categories/media)

kshan/postermaker
=================

A poster maker base on GD lib. 一个用php生成海报的神器。

16PHP

Since Oct 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kshan/poster-maker-php)[ Packagist](https://packagist.org/packages/kshan/postermaker)[ RSS](/packages/kshan-postermaker/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Postermaker 海报生成器
=================

[](#postermaker-海报生成器)

A poster make base on gd lib. (PHP) 一个用php生成海报的神器

Usage 用法
--------

[](#usage-用法)

比如在文件someaction.php中使用：

```
use \Kshan\PosterMaker\Postermaker;

$poster = new Postermaker(800, 1100);
$poster
    ->addImg('./bg.jpg', [0,0], [800, 1100])
    ->addImg('./data/upload/cover.jpg', [30,30],[740, 500])
    ->addImg('./data/upload/avatar.png', [520,620],[200, 200])
    ->addText('2020雅思口语刷题班', 30, [30,610], [255, 255, 255])
    ->addText('授课老师：Rico', 24, [30,720], [255, 255, 255])
    ->addText('coolhand', 24, [30,870], [255, 255, 255])
    ->addText('邀请你一起学习', 24, [30, 910], [255, 255, 255])
    ->addText('长按扫码听课', 24, [30,950], [255, 255, 255])
    ->addQrCode('http://com/123', [500,800],[250,250])
    ->render();

```

### 安装

[](#安装)

```
composer require kshan/postermaker

```

### addImg

[](#addimg)

按大小创建一个海报

```
$poster = new \PosterMaker\Postermaker(800, 1100); // (width, height)

```

### addImg

[](#addimg-1)

添加图片 (图片路径, \[x坐标, y坐标\], \[width, height\])

```
$poster->addImg('./data/upload/cover.jpg', [30,30],[740, 500])

```

### addText

[](#addtext)

添加图片 (文字内容, 字体大小, \[x坐标, y坐标\], 颜色\[R,G,B\])，坐标为设为 'center' 代表居中

```
$poster->addText('2020雅思口语刷题班', 30, ['center',610], [255, 255, 255])

```

### addQrCode

[](#addqrcode)

添加二维码 (文字内容, \[x坐标, y坐标\], \[width, height\], 空白区域大小)

```
$poster->addQrCode('http://com/123', [500,800],[250,250], 4)

```

### render

[](#render)

添加图片 (文字内容, 字体大小, \[x坐标, y坐标\], 颜色\[R,G,B\])

```
$poster->render('./save.png'); // 保持为图片
// or
$poster->render(); // show image in html: ``

```

Thinkphp等框架里中的使用
----------------

[](#thinkphp等框架里中的使用)

因为有些php框架的控制器默认输出html，所以如果在控制器里直接输出图片的话，需要在控制器最后一行加上：

```
return response()->contentType('image/png');

```

或者用exit

```
exit();

```

鸣谢
--

[](#鸣谢)

[moonwalkercui/postermaker](https://github.com/moonwalkercui/postermaker)

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce4c15c8343b1b998a5192307d3e7204d3ea832110d649df5ecebe2cadef947e?d=identicon)[kshan](/maintainers/kshan)

---

Top Contributors

[![kshan](https://avatars.githubusercontent.com/u/1471661?v=4)](https://github.com/kshan "kshan (5 commits)")

### Embed Badge

![Health badge](/badges/kshan-postermaker/health.svg)

```
[![Health](https://phpackages.com/badges/kshan-postermaker/health.svg)](https://phpackages.com/packages/kshan-postermaker)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
