PHP code example of kematjaya / download-bundle

1. Go to this page and download the library: Download kematjaya/download-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/ */

    

kematjaya / download-bundle example snippets


   namespace App\Entity;
   
   use Kematjaya\DownloadBundle\Entity\DownloadInterface;
   
   /**
   * @ORM\Table(name="person")
   */
   class Person implements DownloadInterface
   {
   
     /**
      * @ORM\Column(type="string", length=255, nullable=true)
      */
     private $images;
     
     public function getImages(): ?string
     {
         return $this->images;
     }
 
     public function setImages(?string $images): self
     {
         $this->images = $images;
 
         return $this;
     }
     
     public static function getPaths():array
     {
         return [
             'getImages' => 'person'  
             // 'getImages' is function where contain file name, and 'person' is path where file uploaded inside 'upload_dir' (part 3)
         ];
     }
   }