hshn / base64-encoded-file
提供处理base64编码文件的功能,以及symfony/form的集成
v5.0.1
2023-12-24 07:23 UTC
Requires
- php: ^8.1.0
- symfony/http-foundation: ^5.4 || ^6.0 || ^7.0
- symfony/mime: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0.0
- symfony/config: ^5.4 || ^6.0 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0
- symfony/form: ^5.4 || ^6.0 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.0 || ^7.0
- symfony/serializer: ^5.4 || ^6.0 || ^7.0
Suggests
- symfony/config: to use the bundle in a Symfony project
- symfony/dependency-injection: to use the bundle in a Symfony project
- symfony/form: to use base64_encoded_file type
- symfony/http-kernel: to use the bundle in a Symfony project
- symfony/serializer: to convert a base64 string to a Base64EncodedFile object
README
提供base64编码文件的处理功能
安装
$ php composer.phar require hshn/base64-encoded-file
使用
<?php use Hshn\Base64EncodedFile\HttpFoundation\File\Base64EncodedFile; $file = new Base64EncodedFile(base64_encode($data)); $file->getPathname(); // "/path/to/file" $file instanceof Symfony\Component\HttpFoundation\File\File; // true
symfony/form集成
<?php use Hshn\Base64EncodedFile\Form\Type\Base64EncodedFileType; $form = $formBuilder ->add('file', Base64EncodedFileType::class) ->getForm();
Symfony项目中的集成(手动安装)
在Symfony项目中使用此bundle需要以下库
- symfony/dependency-injection
- symfony/http-kernel
- symfony/config
然后,您可以通过以下配置加载bundle
<?php // bundles.php Hshn\Base64EncodedFile\Bridge\Symfony\Bundle\Base64EncodedFileBundle::class => ['all' => true],