Download the PHP package kocal/ckfinder-symfony-bundle without Composer

On this page you can find all versions of the php package kocal/ckfinder-symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ckfinder-symfony-bundle

CKFinder 3 Bundle for Symfony

Continuous Integration kocal/ckfinder-symfony-bundle

:information_source: This project is a fork of the official and abandoned CKFinder Symfony Bundle.

This bundle is fully compatible with Symfony 6.0 and more (Symfony 3 and 4 have been removed, see branch 1.x for Symfony 5.4 support), compatible with PHP 8.1+, Flysystem 3+, and use many tools to ensure the code quality (PHPUnit, Easy Coding Standard and Rector) with a functional CI.

Installation

  1. Add Composer dependency and install the bundle.

  2. Run the command to download the CKFinder distribution package.

    After installing the bundle you need to download CKFinder distribution package. It is not shipped with the bundle due to different license terms. To install it, run the following Symfony command:

    It will download the code and place it in the Resource/public directory of the bundle. After that you may also want to install assets, so the public directory will be updated with CKFinder code.

  3. Enable bundle routing.

    Create config/routes/ckfinder.yaml with following contents:

  4. Create a directory for CKFinder files and allow for write access to it. By default CKFinder expects it to be placed in <public folder>/userfiles (this can be altered in configuration).

NOTE: Since usually setting permissions to 0777 is insecure, it is advisable to change the group ownership of the directory to the same user as Apache and add group write permissions instead. Please contact your system administrator in case of any doubts.

At this point you should see the connector JSON response after navigating to the /ckfinder/connector?command=Init route. Authentication for CKFinder is not configured yet, so you will see an error response saying that CKFinder is not enabled.

Configuring Authentication

CKFinder connector authentication is managed by the ckfinder.connector.auth service, which by default is defined in the CKSourceCKFinderBundle\Authentication\Authentication class. It contains the authenticate method that should return a Boolean value to decide if the user should have access to CKFinder. As you can see the default service implementation is not complete and simply returns false inside the authenticate method, but you can find it useful as a starting stub code.

To configure authentication for the CKFinder connector you need to create a class that implements CKSource\Bundle\CKFinderBundle\Authentication\AuthenticationInterface, and point the CKFinder connector to use it.

A basic implementation that returns true from the authenticate method (which is obviously not secure) can look like below:

Symfony 5+

You may have noticed that AuthenticationInterface extends ContainerAwareInterface, so you have access to the service container from the authentication class scope.

When your custom authentication is ready, you need to tell the CKFinder connector to start using it. To do that add the following option to your configuration:

Symfony 5+

Create config/packages/ckfinder.yaml file:

Configuration Options

The default CKFinder connector configuration is taken from the @CKSourceCKFinder/Resources/config/ckfinder_config.php file. Thanks to the Symfony configuration merging mechanism there are multiple ways you can overwrite it. The default configuration is provided in form of a regular PHP file, but you can use the format you prefer (YAML, XML) as long as the structure is valid.

The simplest way to overwrite the default configuration is copying the ckfinder_config.php file to your application config directory, and then importing it in the main configuration file:

Symfony 5+

From now all connector configuration options will be taken from copied ckfinder_config.php.

Another way to configure CKFinder is to include required options under the ckfinder node, directly in your config file.

Symfony 5+

Note: All options that are not defined will be taken from the default configuration file.

To find out more about possible connector configuration options please refer to CKFinder 3 – PHP Connector Documentation.

The CKFinder bundle provides two extra options:

Usage

The bundle code contains a few usage examples that you may find useful. To enable them uncomment the ckfinder_examples route in @CKSourceCKFinder/Resources/config/routing.yaml:

After that you can navigate to the /ckfinder/examples path and have a look at the list of available examples. To find out about the code behind them, check the CKFinderController class (CKSourceCKFinderBundle::Controller/CKFinderController.php).

Including the Main CKFinder JavaScript File in Templates

The preferred way to include ckfinder.js in a template is including the CKFinder setup template, like presented below:

The included template renders the required script tags and configures a valid connector path.

CKFinder File Chooser

The bundle registers a form field type — CKFinderFileChooserType — that allows for easy integration of CKFinder as a file chooser in your forms. After choosing the file in CKFinder the corresponding input field is automaticaly filled with the file URL. You can see a working example under the /ckfinder/examples/filechooser path.

The file chooser field is built on top of the regular text type, so it inherits all configuration options. It also provides a few custom options:

Name Type Default Value Description
mode string popup Mode in which CKFinder will be opened after clicking the "Browse" button. Allowed values are modal and popup.
button_text string Browse The text displayed in the button.
button_attr array [] Attributes for the button element.

A simple usage example may look like below:

Note: To use CKFinder file chooser in your forms you still need to include the main CKFinder JavaScript file in your template (see Including the main CKFinder JavaScript file in templates).


All versions of ckfinder-symfony-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-zip Version *
league/flysystem Version ^3.0
league/flysystem-aws-s3-v3 Version ^3.0.1
symfony/framework-bundle Version ^6.0
symfony/form Version ^6.0
symfony/finder Version ^6.0
symfony/console Version ^6.0
symfony/mime Version ^6.0
pimple/pimple Version ^3.0
monolog/monolog Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kocal/ckfinder-symfony-bundle contains the following files

Loading the files please wait ....