Koel (also styled as koel, with a lowercase k) is a web-based personal audio streaming service written in Vue at the client side and Laravel on the server side. Targeting web developers, Koel embraces some of the more modern web technologies – flexbox, audio and drag-and-drop API to name a few – to do its job.
Koel has two components, each with its own set of requirements:
- All requirements by Laravel – PHP, OpenSSL, composer and such. Consider setting PHP's
memory_limitto a good value (512M or better) if you have a big library.
- MySQL, MariaDB, PostgresSQL, or SQLite. Actually, any DBMS supported by Laravel should work.
- If you're building Koel from source, make sure to have Git and NodeJS latest stable with
- Any decent web browser will do – Koel has been tested on Chrome 47, Firefox 42, Safari 8, Opera 34, and Edge.
There are three methods to install and start using Koel:
# Using a Pre-Compiled Archive
Starting from v5.0.0, Koel supports installing from a pre-compiled archive, which eliminates the need of manually compiling the front-end assets.
First, go to the Releases page on GitHub, download either the
.zip file found under "Assets," and unzip it into the destination web root directory. From there, run the following commands:
composer install php artisan koel:init --no-assets # Populate credentials during the process php artisan serve
# Building from Source
From your console, run the following commands:
cd <KOEL_ROOT_DIR> git clone --recurse-submodules https://github.com/koel/koel.git . git checkout latest # Check out the latest version at https://github.com/koel/koel/releases composer install php artisan koel:init php artisan serve
In both cases, you should now be able to visit http://localhost:8000 in your browser and start using Koel.
Use a proper webserver
http://localhost:8000 is only the development server for Koel (or rather, Laravel). For optimal performance, you'll want to set up the production version, the configuration of which varies depending on your webserver of choice (Apache, nginx, Caddy etc.) and is outside of this document's scope, but shouldn't be any different from that of a standard PHP application.
If you're on Debian, here's an unofficial installation guide. This may or may not be out of date, so use it with your own risk.
If you want more control, edit
.env file. There's quite a few settings there to tweak Koel to your needs. Remember to reload the server for the changes to take effects.
# Using Docker
Check out Releases for upgrade guides corresponding to your Koel version and installation method.
# Configuration and Usage
# Music Discovery
There are several ways for Koel to discover your media files. You can manually scan for songs, configure a watcher, host your files with Amazon S3, or upload files directly using the web interface.
# Scan for Songs
The default music discovery method. Upload your songs into a readable directory on your server – preferably outside of your web root dir – and configure Koel to scan and sync it by setting a "media path" under Manage ▸ Settings.
You can also scan from the CLI – which is faster, without a time limit, and provides feedbacks – with the artisan
$ php artisan koel:sync Koel syncing started. 953/953 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% Completed! 944 new or updated song(s), 0 unchanged song(s), and 9 invalid file(s).
Suffix the command with a
-v flag for more details e.g. syncing errors.
This command can also be added as a cron job, for example to run every midnight:
0 0 * * * cd /home/user/webapps/koel/ && /usr/local/bin/php artisan koel:sync >/dev/null 2>&1
As of current, Koel recognizes these audio extensions:
.m4a (experimental), and
.flac (experimental with some limitations). Others may be added in the future.
If you're syncing compilation albums (albums with multiple songs from different artists) make sure the "Band" tag is set, otherwise each song will end up in its own album. Some ripping software set this automatically; check if yours does.
# Watch a directory
Starting from v2.1.0, you can watch a directory and sync on the fly with
# Host your media on Amazon S3
Starting from v3.0.0, you can use Koel with Amazon S3.
# Upload using the web interface
Starting from v4.3.0, if you're logged in as an admin, you can upload songs directly by clicking the "Upload" sidebar menu item. Note that you need to set the media path first, as songs will be uploaded into a
Depending on how big your media files are, you may want to set
post_max_size in your
php.ini correspondingly, or PHP may fail with a
Payload too large error.
# Streaming Music
Koel supports three streaming methods which can be configured via a
STREAMING_METHOD setting in
php: Use native PHP
readfile(). This is the default method, and the slowest and most unstable one. Only use this method if you can't others.
x-sendfile: Use Apache's mod_xsendfile module. You'll need to install and configure the module manually. A sample configuration is as following:
LoadModule xsendfile_module libexec/apache2/mod_xsendfile.so # These configuration can be put in the VirtualHost directive as well <IfModule mod_xsendfile.c> XSendFile on XSendFilePath /mnt/media </IfModule>
STREAMING_METHOD doesn't have effects if you're serving songs from Amazon S3.
# Using the Web Interface
Using the client component of Koel should be straightforward enough. If you've ever used Spotify, you should feel right at home. As a matter of fact, Koel's client interface is a shameless rip-off of Spotify's. You can search, you can sort, you can view by artists or albums, you can create playlists, you can like/unlike songs, and you can create other users to share the vibes. There are a couple of shortcut keys, too, for the nerds:
- F puts the focus into the search box
- Enter plays a song. If multiple songs are being selected, Enter adds them to the bottom of the queue, Shift+Enter queues them to top. Adding a Cmd or Ctrl into the combo plays the first selected song right away.
- Space toggles playback
- J plays the next song in queue
- K plays the previous song in queue
- Ctrl/Cmd+A selects all songs in the current view
- Delete removes selected song(s) from the current queue/playlist
On a modern browser, you can control Koel using hardware media keys without even having Koel or the browser focused.
# Instant Search
Starting from v5.0.0, Koel provides an instant search feature, which perform full-text, fuzzy matches against your database of songs, albums, and artists. By default, Koel uses the TNTSearch engine, which requires no configuration. You can also use Algolia by populating these details into
SCOUT_DRIVER=algolia ALGOLIA_APP_ID=<your-algolia-app-id> ALGOLIA_SECRET=<your-algolia-secret>
If you're upgrading Koel from an older version, you'll also have to create the search indices manually by running this command:
php artisan koel:search:import
All subsequent updates to the music database will be synchronized automatically.
# Upload Artist and Album Images
You can change the artist and album images by dragging and dropping images into the current images in artist/album cards.
# Remote Controller
Starting from v3.7.0, Koel has a (mobile) remote controller that lets you control a desktop instance – play/pause, navigate, turn volume up/down, and add/remove from Favorites.
In order to use the feature:
- Register a Pusher account and create an app
- Populate the app's credentials into
.env(those start with
- Reload the desktop Koel instance
- Go to http://<your-koel-host>/remote on a mobile device to start controlling remotely. You may also want to add the URL to the home screen for faster access later.
# Reset Admin Password
Starting from v4.1.1, Koel comes with a handy CLI command to reset the admin password in case you lose it:
php artisan koel:admin:change-password
For older versions, you can make use of Laravel's Tinker, as described here.
# Mobile Support and Limitation
Koel's fully responsive GUI works fairly well on a mobile device. Certain functionalities are not available (yet), however:
- Shortcut keys don't work (duh)
- Equalizer may not work
- Volume must be controlled from a system level
- Next and previous songs can't be controlled from Control Center or lock screen
Also, since Safari is the new IE, if you're on iOS, it's strongly advised to use Koel with a non-Safari browser such as Firefox, Microsoft Edge, Brave, or Google Chrome. iOS 14 comes with the ability to change the default browser as well.
# Local Development
# Running the Local Webserver
Since Koel makes use of git submodules, you'll want to make sure the submodule is up-to-date:
git pull git submodule update --init --recursive --remote # install the submodule dependencies cd resources/assets yarn install
To start the PHP dev server, which serves as the API of the application, run the following command from the root directory. By default, the server will listen at port
php artisan serve
For the client application itself, run this command:
A development version of Koel should now be available at
http://localhost:8080 with full support for hot module reloading.
Alternatively, you can start both the PHP server and the client application in one go with
yarn dev, which uses
start-server-and-test under the hood.
# Testing, Linting, Static Analysis and Stuff
# PHP-related code quality tasks # Basically, take a look at the "scripts" section in composer.json composer test # Run the PHP test suite composer cs # Run code style checker composer cs:fix # Run code style fixer composer analyze # Run PHP static analysis yarn build # Build a production version of the client application # Client/E2E code quality tasks # You may want to run `yarn build` first. yarn test:e2e # Run the Cypress test suite interactively yarn test:e2e:ci # Run the Cypress test suite non-interactively (CI mode) # These commands need to be run from within the submodule (resources/assets) yarn lint # Lint yarn type-check # TypeScript type checking yarn test # Unit testing
If you're already running
yarn test:e2e, there's no need to start a dev server.
yarn test:e2e calls
yarn dev internally and will eliminate the existing
yarn dev process, if any.
# Sponsors and Support
The continuous development of Koel is made possible thanks to the support from these generous sponsors: