Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ckeditor Uploadwidget Bundle Laravel Package

stinger/ckeditor-uploadwidget-bundle

A Symfony bundle that integrates CKEditor's upload widget, giving editors a simple way to upload and insert files or images. It provides the supporting backend configuration and assets needed to wire CKEditor uploads into your application.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony 2.x-era bundle (last release December 2015) whose only job is to ship and register the CKEditor Upload Widget plugin assets so you don't have to copy them into your project by hand. Treat it as an asset shim, not an application framework.

Minimal steps:

  1. Install the plugin files.

    composer require stinger/ckeditor-uploadwidget-bundle
    

    You will likely need to allow the constraint manually (e.g. "stinger/ckeditor-uploadwidget-bundle": "dev-master" or "*") since it predates modern Composer/Symfony constraints.

  2. Register the bundle in app/AppKernel.php (Symfony 2 style — this will not work with Symfony Flex / 4+):

    new Stinger\CKEditorUploadWidgetBundle\StingerCKEditorUploadWidgetBundle(),
    
  3. Publish the assets so the browser can fetch the plugin:

    php app/console assets:install web --symlink
    php app/console cache:clear
    
  4. Look first at Resources/public/ inside the bundle (via vendor/stinger/ckeditor-uploadwidget-bundle/). That folder contains the actual plugin.js, CSS, and icon that CKEditor loads. Confirm the plugin folder name (typically uploadwidget) so you reference it correctly in step 5.

  5. First use case — enable the plugin in CKEditor and point uploads at your own endpoint:

    CKEDITOR.replace('editor', {
        extraPlugins: 'uploadwidget',
        uploadUrl: '/upload/ckeditor',   // your Symfony route
        filebrowserUploadUrl: '/upload/ckeditor'
    });
    

    The plugin now gives editors drag-and-drop / paste image uploads inside CKEditor, with the actual byte handling done by your controller.

The bundle does no upload handling itself — it only makes the client-side widget available. That distinction is the single most important thing to internalize before you start.

Implementation Patterns

1. Asset-reference pattern (the bundle's real value). Instead of hardcoding a path to web/bundles/stingerckeditoruploadwidget/..., reference the bundle assets in your Twig layout after assets:install:

<script src="{{ asset('bundles/stingerckeditoruploadwidget/plugin.js') }}"></script>

or rely on CKEditor's own plugin loader by setting CKEDITOR.basePath / extraPlugins and letting it resolve plugins/uploadwidget/plugin.js. Check the bundle's Resources/views and Resources/config for the exact alias it registers.

2. Upload endpoint pattern. Because the plugin is client-only, the standard integration is:

  • A Symfony controller action that accepts multipart/form-data (field name is conventionally upload for this plugin — verify against plugin.js).
  • Persist the file (VichUploaderBundle, Gaufrette, or a plain move_uploaded_file into web/uploads).
  • Return JSON the widget can consume, typically:
    { "uploaded": 1, "fileName": "photo.jpg", "url": "/uploads/photo.jpg" }
    
    The exact response contract lives in the plugin's plugin.js — open it and read onUploadResponse/success handlers before writing the controller. This is the number-one place integrations break.

3. Form-field wiring. Pair it with your CKEditor form type (FOSCKEditorBundle, Ivopetkov, or a hand-rolled CKEditorType) by passing the uploadUrl option through the widget config:

$builder->add('body', CKEditorType::class, [
    'config' => [
        'extraPlugins' => 'uploadwidget',
        'uploadUrl'    => '/upload/ckeditor',
    ],
]);

Keep the URL route name in a constant so the JS config and the routing file never drift.

4. Multiple editors / per-editor config. The plugin reads its upload target from the editor instance config, so you can vary uploadUrl per editor (e.g. a public comment editor vs. an admin editor) without touching the bundle — good for tiered permissions.

5. Security integration. Guard the upload action with the same security.yml firewall as the rest of your admin, and validate MIME type and size server-side. The 2015 plugin has no CSRF awareness of its own, so either append a token to uploadUrl or whitelist the route in your CSRF config.

6. When to fork instead of depend. Given the package has effectively zero dependents and no releases since 2015, the sustainable pattern is to copy Resources/public/ into your own web/js/ckeditor/plugins/uploadwidget/ once, drop the Composer dependency, and own the plugin. You keep the working CKEditor integration without carrying an abandoned Symfony 2 bundle.

Gotchas and Tips

  • Symfony version ceiling. The bundle targets Symfony 2.x (AppKernel, app/console, web/). It will not autoload or boot under Symfony 3.4+/4+/5+ without edits. If you're on a modern Symfony, don't fight the bundle — extract the assets and register them yourself.
  • Assets are not served automatically. Forgetting assets:install is the classic failure — CKEditor silently drops extraPlugins: 'uploadwidget'' if it can't fetch plugin.js, and you get no error in the editor. Open the browser Network tab and confirm the plugin.js request returns 200.
  • Name mismatch. The CKEditor plugin name in extraPlugins must match the folder name inside Resources/public/. Inspect the directory; don't assume uploadwidget.
  • Upload response contract. The widget expects a specific JSON shape (and often an HTTP 200 even for errors, with uploaded: 0). A plain Symfony JsonResponse with different keys will make uploads "succeed" on the wire but show an error in the editor. Echo the plugin's own expectations exactly.
  • Route visibility. Pointing uploadUrl at a route that requires an authenticated session works only if cookies are sent — they are by default, but if you use a separate CDN/subdomain for the editor, CORS will bite you.
  • Debugging. There is essentially no server-side logging from this bundle. All diagnosis happens in the browser console (CKEDITOR.instances.editor.plugins.uploadwidget) and the network panel. Add temporary console.log in plugin.js if needed.
  • Cache. After assets:install or editing plugin.js, hard-refresh the browser and cache:clear the Symfony side; CKEditor caches plugin registration per page load.
  • No maintenance. With one star, zero dependents, and a 2015 last release, assume no security patches or Symfony compatibility fixes are coming. Pin the dependency, vendor the asset, and plan a migration path (raw CKEditor plugin + your own Symfony upload controller) rather than building architecture on top of the bundle.
  • Extension point that works. If you do keep the bundle, the cleanest customization is overriding its Twig/asset templates in app/Resources/StingerCKEditorUploadWidgetBundle/ rather than editing vendor files — the standard Symfony 2 bundle override still applies.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource