PHPackages                             wuyumin/file2base64 - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wuyumin/file2base64

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wuyumin/file2base64
===================

File to base64.

v0.3.0(8y ago)39002MITPHPPHP &gt;=5.3.0

Since Oct 14Pushed 8y ago2 watchersCompare

[ Source](https://github.com/wuyumin/File2base64)[ Packagist](https://packagist.org/packages/wuyumin/file2base64)[ Docs](https://github.com/wuyumin/File2base64)[ RSS](/packages/wuyumin-file2base64/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (4)Used By (0)

\[PHP\] file to base64
======================

[](#php-file-to-base64)

[中文说明](https://github.com/wuyumin/File2base64/blob/master/README-CN.md)

base64 files are used for embedding in web pages.

### Usage:

[](#usage)

install in Composer

`composer require wuyumin/file2base64`

php code

```
require __DIR__ . '/../vendor/autoload.php';

use File2base64\File2base64;

$file2base64 = new File2base64();
# $file2base64 = new File2base64(['bmp' => 'image/bmp']);

$file2base64->toFile('file2base64.png', 'file2base64.txt');
# echo $file2base64->toBase64('file2base64.png');
```

### Laravel Framework

[](#laravel-framework)

（tips：Laravel 5.5+ can ignore step 2、3，version 5.5+ support to register automatically）

1. Composer install `composer require wuyumin/file2base64`
2. (ServiceProvider)add the follow line to the section `providers` of `config/app.php`
    `File2base64\Laravel\ServiceProvider::class,`
3. (Facades)add the follow line to the section `aliases` of `config/app.php`(optional)
    `'File2base64' => File2base64\Laravel\Facade::class,`

### Result:

[](#result)

base64 file string

```
data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
```

### HTML code use like this:

[](#html-code-use-like-this)

html code

```

```

web page demo: [All in one page with base64 audio,no web link with audio file](https://wuyumin.github.io/File2base64/demo/allinone.html)

### Supported Type:

[](#supported-type)

.png、.jpg、.jpeg、.gif、.ico、.mp3、.ogg

You can init for other type use array.

`$file2base64 = new File2base64(['bmp' => 'image/bmp']);`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09b199fff753831345db62ea81dcd24fb1389cc0e8d97b0094630b411198e5ad?d=identicon)[wuyumin](/maintainers/wuyumin)

---

Top Contributors

[![wuyumin](https://avatars.githubusercontent.com/u/13041600?v=4)](https://github.com/wuyumin "wuyumin (13 commits)")

---

Tags

base64file-to-base64file2base64filetobase64laravelbase64file2base64filetobase64file to base64Yumin Wuwuyumin

### Embed Badge

![Health badge](/badges/wuyumin-file2base64/health.svg)

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

###  Alternatives

[highideas/laravel-users-online

This package will provide an online users management.

203113.2k1](/packages/highideas-laravel-users-online)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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