PHP code example of ckfinder / ckfinder-laravel-package

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

    

ckfinder / ckfinder-laravel-package example snippets


   // 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',
           // ...
       ];
   }
   

    // 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/*',
            // ...
        ];
    }
    

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

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

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

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

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

Route::any('/ckfinder/examples/{example?}', 'CKSource\CKFinderBridge\Controller\CKFinderController@examplesAction')
    ->name('ckfinder_examples');
bash
    php artisan ckfinder:download
    
bash
    php artisan vendor:publish --tag=ckfinder-assets --tag=ckfinder-config
    
bash
    php artisan vendor:publish --tag=ckfinder-views
    
bash
    php artisan vendor:publish --tag=ckfinder
    
bash
php artisan make:middleware CustomCKFinderAuth
routes/web.php