1. Go to this page and download the library: Download atans/memobird library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
atans / memobird example snippets
Atans\Content\PrintContent;
use Atans\Memobird\Memobird;
$memobird = new Memobird('API KEY');
$memobirdId = 'Your memobird device id';
$printContent = new PrintContent();
// Set font
// 设置字体
$printContent->setFont('path/to/font.ttf');
// Add a text
// 增加一段文字
$printContent->addText('Hello World');
// Add text twice
// 重复加文字
$printContent->addText('Hello World')
->addText('Add another text');
// Add an photo
// 增加相片
$printContent->addPhoto('path/to/photo.jpg');
// Add photo twice
// 增加多张相片
$printContent->addPhoto('path/to/photo.jpg')
->addPhoto('path/another/photo.jpg');
// Add an photo from image resource
// 增加相片资源后的内容
$photoContent = file_get_contents('path/to/photo.png');
$printContent->addPhoto($photoContent);
// Add text and photo
// 增加文字和图片
$printContent->addText('Hello World')
->addPhoto('path/to/photo.png');
// Add a text image
// 增加文字图
$printContent->addTextImage('Hello world');
// or
$printContent->addTextImage('Hello world', [
'align' => PrintContent::ALIGN_CENTER,
'font' => 'path/to/font.ttf',
// ... more option please see src/Memobird/Content/PrintContent.php
// ... 更多设置请看 src/Memobird/Content/PrintContent.php
]);
// Add a line
// 加一条线
$printContent->addLine();
// Add a Qr Code
// 增加 二维码
$printContent->addQrCode('http://memobird.cn');
$printContent->addQrCode('http://memobird.cn', [
'logo' => 'path/to/logo.jpg',
// ... more option please see src/Memobird/Content/PrintContent.php
// ... 更多设置请看 src/Memobird/Content/PrintContent.php
]);
// Add printed time
// 加列印时间
$printContent->addPrintedTime();
// Remove all content
// 刪除所有內容
// $printContent->removeAll();
// Print
// 打印
$printPaperResult = $memobird->printPaper($memobirdId, $printContent);
// Get print status
// 取得打印状态
$printStatusResult = $memobird->printStatus($printPaperResult->getPrintcontentid());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.