php-solution / file-storage-bundle
This bundle provides an additional functionality for work with files
Installs: 130
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
pkg:composer/php-solution/file-storage-bundle
Requires
- php: ^7.0
- php-solution/doctrine-orm-extra-lib: ^0.3
- symfony/dependency-injection: ^3.3|^4.0
- symfony/event-dispatcher: ^3.3|^4.0
- symfony/http-foundation: ^3.3|^4.0
- symfony/http-kernel: ^3.3|^4.0
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0||~6.0
README
Install
$ composer require php-solution/file-storage-bundle
Usage
-
Add bundle to your application
-
Create AbstractFile:
<?php namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use PhpSolution\Doctrine\Entity\IdGeneratedTrait; use PhpSolution\FileStorageBundle\Entity\AbstractUploadedFile; use PhpSolution\StdLib\FrequentField\Interfaces\IdentifiableInterface; /** * @ORM\Entity() * @ORM\Table(name="file") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") */ abstract class AbstractFile extends AbstractUploadedFile implements IdentifiableInterface { use IdGeneratedTrait; }
- Create CustomFile. And implement getStorageBucket function
<?php namespace AppBundle\Entity; use AppBundle\Entity\AbstractFile; /** * CustomFile */ class CustomFile extends AbstractFile { /** * @return string */ public function getStorageBucket(): string { return 'custom'; } }