PHPackages                             ckfinder/ckfinder-laravel-package - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ckfinder/ckfinder-laravel-package

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ckfinder/ckfinder-laravel-package
=================================

CKFinder 3 package for Laravel

v5.0.2(4mo ago)159497.2k↑11.8%88[39 issues](https://github.com/ckfinder/ckfinder-laravel-package/issues)[1 PRs](https://github.com/ckfinder/ckfinder-laravel-package/pulls)20MITBladePHP &gt;=8.1.0CI failing

Since Jul 13Pushed 4mo ago13 watchersCompare

[ Source](https://github.com/ckfinder/ckfinder-laravel-package)[ Packagist](https://packagist.org/packages/ckfinder/ckfinder-laravel-package)[ RSS](/packages/ckfinder-ckfinder-laravel-package/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (27)Used By (20)

### [![](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 9+ [![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-9-)

![Laravel version](https://camo.githubusercontent.com/f75b615b3738bcf69b8db02c3329af0ad17b290218c23a6236f26528685c20f0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392b2d677265656e2e737667)[![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 repository contains the CKFinder 3 Package for Laravel 9+. If you are looking for a package for older version of Laravel, please use [version 3](https://github.com/ckfinder/ckfinder-laravel-package/tree/v3.x.x).

### [![](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 ckfinder/ckfinder-laravel-package
    ```
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-assets --tag=ckfinder-config
    ```

    This will publish CKFinder assets to `public/js/ckfinder`, and the CKFinder connector configuration to `config/ckfinder.php`.

    You can also publish the views used by this package in case you need custom route names, different assets location, file browser customization etc.

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

    Finally, you can publish package's configuration, assets and views using only one command.

    ```
    php artisan vendor:publish --tag=ckfinder
    ```
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.
5. CKFinder by default uses a CSRF protection mechanism based on [double submit cookies](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie). On some configurations it may be required to configure Laravel not to encrypt the cookie set by CKFinder. To do that:

    **For Laravel &lt;= 10:**

    Please add the cookie name `ckCsrfToken` to the `$except` property of `EncryptCookies` middleware:

    ```
    // app/Http/Middleware/EncryptCookies.php

    namespace App\Http\Middleware;

    use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;

    class EncryptCookies extends Middleware
    {
        /**
         * The names of the cookies that should not be encrypted.
         *
         * @var array
         */
        protected $except = [
            'ckCsrfToken',
            // ...
        ];
    }
    ```

    You should also disable Laravel's CSRF protection for CKFinder's path, as CKFinder uses its own CSRF protection mechanism. This can be done by adding `ckfinder/*` pattern to the `$except` property of `VerifyCsrfToken` middleware:

    ```
    // app/Http/Middleware/VerifyCsrfToken.php

    namespace App\Http\Middleware;

    use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

    class VerifyCsrfToken extends Middleware
    {
        /**
         * The URIs that should be excluded from CSRF verification.
         *
         * @var array
         */
        protected $except = [
            'ckfinder/*',
            // ...
        ];
    }
    ```

    **For Laravel &gt;= 11:**

    Two calls must be added, which introduce exceptions in CSRF protection mechanism.

    First one configure Laravel not to encrypt the cookie set by CKFinder:

    ```
    $middleware->encryptCookies(except: [
        'ckCsrfToken',
    ]);
    ```

    Second one disables Laravel's CSRF protection for CKFinder's path:

    ```
    $middleware->validateCsrfTokens(except: [
        'ckfinder/*'
    ]);
    ```

    File `bootstrap/app.php` should look like this:

    ```
    // bootstrap/app.php
    use Illuminate\Foundation\Application;
    use Illuminate\Foundation\Configuration\Exceptions;
    use Illuminate\Foundation\Configuration\Middleware;

    return Application::configure(basePath: dirname(__DIR__))
        ->withRouting(
            web: __DIR__.'/../routes/web.php',
            commands: __DIR__.'/../routes/console.php',
            health: '/up',
        )
        ->withMiddleware(function (Middleware $middleware): void {
            $middleware->validateCsrfTokens(except: [
                'ckfinder/*'
            ]);
            $middleware->encryptCookies(except: [
                'ckCsrfToken',
            ]);
        })
        ->withExceptions(function (Exceptions $exceptions): void {
        })->create();
    ```

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 you copy the routes from `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.

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

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

Configuration Options
---------------------

[](#configuration-options)

The CKFinder connector configuration is taken from the `config/ckfinder.php` file.

To find out more about possible connector configuration options please refer to the [CKFinder for PHP connector documentation](https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html).

Usage
-----

[](#usage)

The package code contains a couple of usage examples that you may find useful. To enable them, uncomment the `ckfinder_examples`route in `vendor/ckfinder/ckfinder-laravel-package/src/routes.php`:

```
// vendor/ckfinder/ckfinder-laravel-package/src/routes.php

Route::any('/ckfinder/examples/{example?}', 'CKSource\CKFinderBridge\Controller\CKFinderController@examplesAction')
    ->name('ckfinder_examples');
```

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 `views/samples` directory in the package (`vendor/ckfinder/ckfinder-laravel-package/views/samples/`).

### Including the Main CKFinder JavaScript File in Templates

[](#including-the-main-ckfinder-javascript-file-in-templates)

To be able to use CKFinder on a web page you have to include the main CKFinder JavaScript file. The preferred way to do that is to include the CKFinder setup template, as shown below:

```
@include('ckfinder::setup')
```

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

```

CKFinder.config( { connectorPath: '/ckfinder/connector' } );
```

---

Useful Links
------------

[](#useful-links)

- [CKFinder 3 usage examples](https://ckeditor.com/docs/ckfinder/demo/ckfinder3/samples/widget.html)
- [CKFinder 3 for PHP connector documentation](https://ckeditor.com/docs/ckfinder/ckfinder3-php/)
- [CKFinder 3 Developer's Guide](https://ckeditor.com/docs/ckfinder/ckfinder3/)
- [CKFinder 3 issue tracker](https://github.com/ckfinder/ckfinder)

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance72

Regular maintenance activity

Popularity55

Moderate usage in the ecosystem

Community42

Growing community involvement

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 63.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Recently: every ~159 days

Total

26

Last Release

127d ago

Major Versions

v3.x-dev → v4.0.02022-11-10

3.6.1.x-dev → v4.0.22023-10-02

3.7.0.x-dev → v5.0.02024-04-16

3.7.1.x-dev → v5.0.22026-01-12

PHP version history (2 changes)v3.4.4PHP &gt;=5.6.0

v4.0.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/98c44ba9273e4121dbda1ab67b60f58014eed26e857a21c2b4fb0c7042630843?d=identicon)[cksource](/maintainers/cksource)

![](https://www.gravatar.com/avatar/59d0420c69bdcb56f0009e77fd41ad3e188d5522206dd700e897b748072b3b7d?d=identicon)[zaak](/maintainers/zaak)

---

Top Contributors

[![zaak](https://avatars.githubusercontent.com/u/803299?v=4)](https://github.com/zaak "zaak (72 commits)")[![bmlotek](https://avatars.githubusercontent.com/u/112854881?v=4)](https://github.com/bmlotek "bmlotek (16 commits)")[![marcin-betlinski](https://avatars.githubusercontent.com/u/25298278?v=4)](https://github.com/marcin-betlinski "marcin-betlinski (9 commits)")[![vokiel](https://avatars.githubusercontent.com/u/422571?v=4)](https://github.com/vokiel "vokiel (4 commits)")[![bkstar123](https://avatars.githubusercontent.com/u/12879662?v=4)](https://github.com/bkstar123 "bkstar123 (4 commits)")[![Yahav](https://avatars.githubusercontent.com/u/113236?v=4)](https://github.com/Yahav "Yahav (1 commits)")[![YukiMatsuo](https://avatars.githubusercontent.com/u/13804893?v=4)](https://github.com/YukiMatsuo "YukiMatsuo (1 commits)")[![AnnaTomanek](https://avatars.githubusercontent.com/u/538321?v=4)](https://github.com/AnnaTomanek "AnnaTomanek (1 commits)")[![zacksleo](https://avatars.githubusercontent.com/u/3369169?v=4)](https://github.com/zacksleo "zacksleo (1 commits)")[![IP-Developer](https://avatars.githubusercontent.com/u/2005081?v=4)](https://github.com/IP-Developer "IP-Developer (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![serderovsh](https://avatars.githubusercontent.com/u/24723913?v=4)](https://github.com/serderovsh "serderovsh (1 commits)")[![vinhpd192](https://avatars.githubusercontent.com/u/7612443?v=4)](https://github.com/vinhpd192 "vinhpd192 (1 commits)")

### Embed Badge

![Health badge](/badges/ckfinder-ckfinder-laravel-package/health.svg)

```
[![Health](https://phpackages.com/badges/ckfinder-ckfinder-laravel-package/health.svg)](https://phpackages.com/packages/ckfinder-ckfinder-laravel-package)
```

###  Alternatives

[ckfinder/ckfinder-symfony-bundle

CKFinder bundle for Symfony

42435.7k](/packages/ckfinder-ckfinder-symfony-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
