1. Go to this page and download the library: Download floppy/bundle 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/ */
floppy / bundle example snippets
public function registerBundles() {
return array(
//...
new Floppy\Bundle\FloppyBundle(),
//...
);
}
namespace ...
use Floppy\Common\FileId;
use Doctrine\ORM\Mapping as ORM;
class Document {
/**
* @ORM\Column(type='floppy_file')
*/
private $file;
public function setFile(FileId $fileId = null) {
$this->file = $fileId;
}
public function getFile() {
return $fileId;
}
}
class DocumentFormType extends .... {
public function buildForm(...) {
$builder->add('file', 'floppy_file');
}
//...rest ommited
}
//form definition
class DocumentFormType extends .... {
public function buildForm(...) {
$builder->add('file', 'floppy_file');
}
//...rest ommited
}
namespace ...
use Floppy\Common\FileId;
use Doctrine\ORM\Mapping as ORM;
class Document {
/**
* @ORM\Column(type='floppy_file')
*/
private $file;
/**
* @ORM\Column(type='string', length=50)
*/
private $mimeType;
public function setFile(FileId $fileId = null) {
$this->file = $fileId;
//you can store additional info in custom properties
if($fileId !== null && $fileId->info()->get('mime-type')) {
$this->mimeType = $fileId->info()->get('mime-type');
}
}
public function getFile() {
return $fileId;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.