filepicker-bundle
Symfony Bundle for adding a file picker component to form inputs, (*1)
Warning: This package is at a very early stage of development. Use at your own risk
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:, (*2)
$ composer require evansmwendwa/filepicker-bundle "dev-master"
This command requires you to have Composer installed globally, as explained
in the installation chapter
of the Composer documentation., (*3)
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:, (*4)
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Evans\FilepickerBundle\EvansFilepickerBundle(),
);
// ...
}
// ...
}
Step 3: Create config parameters
# app/config/config.yml
evans_filepicker:
uploads_destination: '/uploads/images'
allow_uploads: true
allowed_mimes: ['image/jpeg','image/png','image/gif']
group_files: false
# Twig Configuration
twig:
form_themes:
- EvansFilepickerBundle::form/fields.html.twig
Step 5: Load bundle assets in your Twig Template
The bundle provides two twig functions for loading the necessary HTML, CSS and JS.
Add these functions somewhere in your twig template. Can be base in you base template if necessary, (*5)
# loads necessary html and js files
{{ file_picker_init() }}
# loads necessary css files
{{ file_picker_init_css() }}
Step 6: Register FilepickerBundle Routes
# app/config/routing.yml
evans_filepicker:
resource: "@EvansFilepickerBundle/Resources/config/routing.yml"
prefix: /
Using the built in CKE Editor Plugin
Instructions coming soon
, (*6)
Using File picker bundle with Symfony EasyAdminBundle
Instructions coming soon
, (*7)