PHPackages                             bkstar123/laravel-ckfinder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bkstar123/laravel-ckfinder

ActiveLibrary

bkstar123/laravel-ckfinder
==========================

CKFinder 3 package for Laravel

1.0.6(3y ago)017MITBladePHP &gt;=5.6.0

Since Mar 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bkstar123/laravel-ckfinder)[ Packagist](https://packagist.org/packages/bkstar123/laravel-ckfinder)[ RSS](/packages/bkstar123-laravel-ckfinder/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (8)Used By (0)

### [![](https://user-images.githubusercontent.com/803299/42567830-6b6d3ad6-850b-11e8-9151-43021c92d8b7.png)](https://user-images.githubusercontent.com/803299/42567830-6b6d3ad6-850b-11e8-9151-43021c92d8b7.png)

[](#)

CKFinder 3 Package for Laravel 5.5+ [![Tweet](https://camo.githubusercontent.com/cb820a0ecc9645168e33b03925d7f14691262ddbaeaf66a0a91697803d0cba2d/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c)](https://twitter.com/intent/tweet?text=Check%20out%20CKFinder%20package%20for%20Laravel%20&url=https://github.com/ckfinder/ckfinder-laravel-package)
==============================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#ckfinder-3-package-for-laravel-55-)

![Laravel version](https://camo.githubusercontent.com/2c9d8c6612a9cfbb4bd816456f0d4271070b0e5bfb4501acf17cab1987adb8c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e35253243253230352e362d677265656e2e737667)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![Packagist](https://camo.githubusercontent.com/5144b8ccb7f77a9cf26eb8ad862e90839e4b824fd090a830044a7799bc804d83/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636b66696e6465722f636b66696e6465722d6c61726176656c2d7061636b6167652e737667)](https://packagist.org/packages/ckfinder/ckfinder-laravel-package)[![Packagist](https://camo.githubusercontent.com/df88a22370c44623931ed1dff3b29dfa30330e4b60a0e5d3052d2bbb3c9d2334/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636b66696e6465722f636b66696e6465722d6c61726176656c2d7061636b6167652e737667)](https://packagist.org/packages/ckfinder/ckfinder-laravel-package)[![Join newsletter](https://camo.githubusercontent.com/e49ed15dff4cf969e387dcf391e1e84ab78caca0c695b9f150c76d8d380c9d59/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d6e6577736c65747465722d3030636339392e737667)](http://eepurl.com/c3zRPr)[![Follow twitter](https://camo.githubusercontent.com/6619143c5a96ebe7fa1dd1d40d16f8587b519a91c003d7b472d5047c36e6b744/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f666f6c6c6f772d747769747465722d3030636339392e737667)](https://twitter.com/ckeditor)

This is a minor customization of  repository.

This repository contains the CKFinder 3 Package for Laravel 5.5+.

### [![](https://user-images.githubusercontent.com/803299/42693315-18717aae-86af-11e8-863a-74070edb3912.png)](https://ckeditor.com/docs/ckfinder/demo/ckfinder3/samples/widget.html)

[](#-1)

Installation
------------

[](#installation)

1. Add a Composer dependency and install the package.

    ```
    composer require bkstar123/laravel-ckfinder
    ```
2. Run the command to download the CKFinder code.

    After installing the Laravel package you need to download CKFinder code. It is not shipped with the package due to different license terms. To install it, run the following `artisan` command:

    ```
    php artisan ckfinder:download
    ```

    It will download the required code and place it inside an appropriate directory of the package (`vendor/ckfinder/ckfinder-laravel-package/`).
3. Publish the CKFinder connector configuration and assets.

    ```
    php artisan vendor:publish --tag=ckfinder
    ```

    This will publish CKFinder assets to `public/js/ckfinder`, and the CKFinder connector configuration to `config/ckfinder.php`.
4. Create a directory for CKFinder files and allow for write access to it. By default CKFinder expects the files to be placed in `public/userfiles` (this can be altered in the configuration).

    ```
    mkdir -m 777 public/userfiles
    ```

**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` address. Authentication for CKFinder is not configured yet, so you will see an error response saying that CKFinder is not enabled.

Configuring Authentication
--------------------------

[](#configuring-authentication)

CKFinder connector authentication is handled by [middleware](https://laravel.com/docs/5.8/middleware) class or alias. To create the custom middleware class, use the artisan command:

```
php artisan make:middleware CustomCKFinderAuth
```

The new middleware class will appear in `app/Http/Middleware/CustomCKFinderAuth.php`. Change the `authentication` option in `config/ckfinder.php`:

```
$config['authentication'] = '\App\Http\Middleware\CustomCKFinderAuth';
```

The `handle` method in `CustomCKFinderAuth` class allows to authenticate CKFinder users. A basic implementation that returns `true` from the `authentication` callable (which is obviously **not secure**) can look like below:

```
public function handle($request, Closure $next)
{
    config(['ckfinder.authentication' => function() {
        return true;
    }]);
    return $next($request);
}
```

Please have a look at the [CKFinder for PHP connector documentation](https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_authentication) to find out more about this option.

**Note**:

- Alternatively, You can set the configuration option `$config['loadRoutes'] = false;` in `config/ckfinder.php`. Then, copy the routes in `vendor/ckfinder/ckfinder-laravel-package/src/routes.php` to your application routes such as `routes/web.php` to protect them with your Laravel auth middleware. You must also prefix the controller namespace with backward slash so that Laravel will not prepend the default `App\Http\Controllers`.

For example:

```
Route::any('/ckfinder/connector', '\CKSource\CKFinderBridge\Controller\CKFinderController@requestAction')
    ->name('ckfinder_connector');

Route::any('/ckfinder/browser', '\CKSource\CKFinderBridge\Controller\CKFinderController@browserAction')
    ->name('ckfinder_browser');
```

- Disable Laravel CSRF protection for `/ckfinder/*` routes, as follows:

In **app/Http/Middleware/VerifyCsrfToken.php**, add:

```
