bitandblack/base64-string
Composer 安装命令:
composer require bitandblack/base64-string
包简介
Encodes files to base64 strings and decodes base64 strings to files.
README 文档
README
Bit&Black Base64 String
Encodes files to base64 strings and decodes base64 strings to files.
Installation
This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/base64-string.
Usage
Initialize the Base64String with the path to the file you want to encode:
<?php
use BitAndBlack\Base64String\Base64String;
$base64String = new Base64String('/path/to/myfile.txt');
You can access the single parts of the base64 string now like that:
<?php
/** Will echo something like "data:text/plain;base64,SGVsbG8gV29ybGQh..." */
echo $base64String->getBase64String();
/** Will echo "text/plain" */
echo $base64String->getMimeType();
Or simply echo the object:
<?php
/** This will also echo something like "data:text/plain;base64,SGVsbG8gV29ybGQh..." */
echo new Base64String('/path/to/myfile.txt');
Backwards
You can also convert a base64 encoded string and extract its parts:
<?php
use BitAndBlack\Base64String\Base64File;
$base64File = new Base64File('data:text/plain;base64,SGVsbG8gV29ybGQh');
You can access the single parts of the file now like that:
<?php
/** Will echo "txt" */
echo $base64File->getExtension();
/** Will echo "Hello World!" using the input string above */
echo $base64File->getContent();
/** Will echo "text/plain" */
echo $base64File->getMimeType();
With that information it is easy to write that file to the file system:
<?php
file_put_contents(
'myfile.txt', /** Or `'myfile.' . $base64File->getExtension(),` if you prefer. */
$base64File
);
Help
If you have any questions, feel free to contact us under hello@bitandblack.com.
Further information about Bit&Black can be found under www.bitandblack.com.
bitandblack/base64-string 适用场景与选型建议
bitandblack/base64-string 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 132 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bitandblack/base64-string 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bitandblack/base64-string 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 132
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-11